Is it possible to feed bound key combinations via stdin?

Open
#1,637 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Start by tracing how prompt-toolkit reads stdin and turns input into key events, then compare that path with the existing ESC and Enter key binding handling. Done means a documented or implemented way for \x1B\x0D from stdin to trigger the same bound action instead of being inserted as visible characters.

Written by the indexing model from the issue text.

Description

IPython uses prompt-toolkit and I'm trying to send code to an IPython console via standard input. IPython binds ESC, Enter to execute code. Is it possible to configure prompt-toolkit somehow to process keybindings seen in stdin? If I send \x1B\x0D, the characters appear on-screen; I'd like that to be the same as if I pressed ESC and then Enter.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from prompt-toolkit/python-prompt-toolkit

All issues in prompt-toolkit/python-prompt-toolkit

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.