Skip to content

Add some values to enum Keys#2040

Open
Freed-Wu wants to merge 1 commit into
prompt-toolkit:mainfrom
Freed-Wu:enter
Open

Add some values to enum Keys#2040
Freed-Wu wants to merge 1 commit into
prompt-toolkit:mainfrom
Freed-Wu:enter

Conversation

@Freed-Wu
Copy link
Copy Markdown
Contributor

@Freed-Wu Freed-Wu commented Dec 9, 2025

Fix #2006.
Although Keys.ShiftEnter, Keys.ControlEnter, Keys.ControlShiftEnter cannot work,
(Keys.Escape, Keys.ControlEnter) and (Keys.Escape, Keys.ControlShiftEnter) can work.
Before this PR, we have to:

@add_key_binding(Keys.Escape, *"[27;8;13~")
def _(event: KeyPressEvent) -> None:
    ...

Now we can:

@add_key_binding(Keys.Escape, Keys.ControlShiftEnter)
def _(event: KeyPressEvent) -> None:
    ...

Fix prompt-toolkit#2006.
Although Keys.ShiftEnter, Keys.ControlEnter, Keys.ControlShiftEnter cannot work,
(Keys.Escape, Keys.ControlEnter) and (Keys.Escape, Keys.ControlShiftEnter) can work.
Before this PR, we have to:

    @add_key_binding(Keys.Escape, *"[27;8;13~")
    def _(event: KeyPressEvent) -> None:
        ...

Now we can:

    @add_key_binding(Keys.Escape, Keys.ControlShiftEnter)
    def _(event: KeyPressEvent) -> None:
        ...
@ironfroggy
Copy link
Copy Markdown

I found prompt-toolkit specifically when looking to implement some multi-line entry functionality that followed common enter-sends / shift+enter-inserts-newline behavior and was dismayed to find that particular combination unsupported. Is there any barrier to this PR being merged for a future release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants