[feature] support c-enter/c-s-enter/s-enter

Open
#2,006 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Reproduce the reported sequences with showkey -a, then trace prompt-toolkit's key binding and escape-sequence handling for c-enter, s-enter, and c-s-enter. Done means these sequences can be registered with add_key_binding and invoke their handlers, including the forms shown in the issue.

Written by the indexing model from the issue text.

Description

showkey -a display:

  • Shift + Enter: ^[[27;2;13~
  • Control + Enter: ^[[27;5;13~
  • Control + Shift + Enter: ^[[27;6;13~

First, prompt-toolkit miss c-enter, s-enter, ...

Second, Even if I

    @add_key_binding(*["escape", "[27;2;13~"])
    def _(event: KeyPressEvent) -> None:
        print("hi")

It still cannot work.

Weirdly, the following keys can work.

  • Alt + Control + Enter
  • Alt + Control + Shift + Enter
    @add_key_binding(["escape", *"[27;8;13~"])
    def _(event: KeyPressEvent) ->None:
        print("hi")
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.