Shift+Enter always submits, breaking PSReadline features [Windows.Terminal] #784

Closed
opened 2026-01-30 22:04:02 +00:00 by claunia · 13 comments
Owner

Originally created by @Jaykul on GitHub (May 7, 2019).

Originally assigned to: @zadjii-msft on GitHub.

  • Your Windows build number: (Type ver at a Windows Command Prompt)
Microsoft Windows [Version 10.0.18362.86]
  • What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots)

Trying to add an empty line in a multi-line input by pressing Shift + Enter with PSReadline in PowerShell

  • What's wrong / what should be happening instead:

Shift+Enter is treated as Enter, and it tries to run my incomplete command line

Originally created by @Jaykul on GitHub (May 7, 2019). Originally assigned to: @zadjii-msft on GitHub. * Your Windows build number: (Type `ver` at a Windows Command Prompt) ``` Microsoft Windows [Version 10.0.18362.86] ``` * What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots) Trying to add an empty line in a multi-line input by pressing `Shift` + `Enter` with PSReadline in PowerShell * What's wrong / what should be happening instead: `Shift+Enter` is treated as `Enter`, and it tries to run my incomplete command line
Author
Owner

@zadjii-msft commented on GitHub (May 7, 2019):

So I'm not sure this is fixable without a lot of work.

Because the Windows Terminal is using ConPTY as a backend, we can only send keypresses to the attached client app that are encodable by VT sequences. Unfortunately, there's no way to differentiate between Enter and Shift+Enter with just VT.

So, we need to add support for encoding entire INPUT_RECORDs as VT sequences. Then add support to conpty (in InputStatemachineEngine.*) for parsing such an input record. Then we need to enable the terminal to tell conpty that it should expect such a type of input sequences, and the terminal needs to be able to synthesize them.

It's something that's doable, but not without at least a weeks worth of work, not including testing.

@zadjii-msft commented on GitHub (May 7, 2019): So I'm not sure this is fixable without a _lot_ of work. Because the Windows Terminal is using ConPTY as a backend, we can only send keypresses to the attached client app that are encodable by VT sequences. Unfortunately, there's no way to differentiate between Enter and Shift+Enter with just VT. So, we need to add support for encoding entire `INPUT_RECORD`s as VT sequences. Then add support to conpty (in `InputStatemachineEngine.*`) for parsing such an input record. Then we need to enable the terminal to tell conpty that it should expect such a type of input sequences, and the terminal needs to be able to synthesize them. It's something that's doable, but not without at least a weeks worth of work, not including testing.
Author
Owner

@Jaykul commented on GitHub (May 8, 2019):

Ouch. Didn't even think of that.

At least in PSReadLine it's settable, so I will just have to try to learn to use Ctrl+Enter instead
... that seems to send a linefeed instead of a carriage return, so it's detectable.

There's probably a bigger picture here about helping those of us who aren't used to VT learn which combinations just aren't going to work...

@Jaykul commented on GitHub (May 8, 2019): Ouch. Didn't even think of that. At least in PSReadLine it's settable, so I will just have to try to learn to use `Ctrl+Enter` instead ... that seems to send a linefeed instead of a carriage return, so it's detectable. There's probably a bigger picture here about helping those of us who aren't used to VT learn which combinations just aren't going to work...
Author
Owner

@pingzing commented on GitHub (May 17, 2019):

This actually seems to be a bit of a broader problem--a lot of PSReadLine hotkeys that use Ctrl+ chords don't work either. Ctrl+Space and Ctrl+. come to mind as well.

EDIT: Interestingly, it seems similar to the issue experienced by xterm.js-based terminal emulators on Windows, as noted in the PSReadLine repo: https://github.com/PowerShell/PSReadLine/issues/877 Ctrl+. is interpreted as Ctrl+@ in the Windows Terminal as well, for example. At a guess, because xterm.js on Windows uses WinPTY which does a pretty similar thing to ConPTY's VT processing?

@pingzing commented on GitHub (May 17, 2019): This actually seems to be a bit of a broader problem--a lot of PSReadLine hotkeys that use Ctrl+<key> chords don't work either. `Ctrl+Space` and `Ctrl+.` come to mind as well. EDIT: Interestingly, it seems similar to the issue experienced by xterm.js-based terminal emulators on Windows, as noted in the PSReadLine repo: https://github.com/PowerShell/PSReadLine/issues/877 `Ctrl+.` is interpreted as `Ctrl+@` in the Windows Terminal as well, for example. At a guess, because xterm.js on Windows uses WinPTY which does a pretty similar thing to ConPTY's VT processing?
Author
Owner

@flxflx commented on GitHub (Jun 25, 2019):

The issue seems to prevent the typing of certain characters on non-US keyboard layouts. For example, I cannot type backspace (alt-gr+?) on my German keyboard. This makes Terminal pretty much unusable for me.

@flxflx commented on GitHub (Jun 25, 2019): The issue seems to prevent the typing of certain characters on non-US keyboard layouts. For example, I cannot type backspace (alt-gr+?) on my German keyboard. This makes Terminal pretty much unusable for me.
Author
Owner

@krokofant commented on GitHub (Dec 5, 2019):

Any known workaround for this?

@krokofant commented on GitHub (Dec 5, 2019): Any known workaround for this?
Author
Owner

@herolover commented on GitHub (Dec 23, 2019):

It's really important. In Far I can't open a windows explorer by pressing shift+enter, or call a context menu by pressing a corresponding key of keyboard.

@herolover commented on GitHub (Dec 23, 2019): It's really important. In Far I can't open a windows explorer by pressing shift+enter, or call a context menu by pressing a corresponding key of keyboard.
Author
Owner

@Jaykul commented on GitHub (Dec 24, 2019):

I think the workaround is to use different hotkeys or different (VT-capable) apps.

The bottom line is that Windows Terminal is a Terminal Emulator, and both it and ConPTY are inherently limited by (really ancient) standards. I'm almost positive that "we" (the community of Windows users?) don't want to simultaneously "embrace and extend" those standards 😉

I still think the best solution is just education about what key combinations can't be encoded ...

@Jaykul commented on GitHub (Dec 24, 2019): I think the workaround is to use different hotkeys or different (VT-capable) apps. The bottom line is that Windows Terminal is a _Terminal Emulator_, and both it and ConPTY are inherently limited by (really ancient) standards. I'm almost positive that "we" (the community of Windows users?) don't want to simultaneously "embrace and extend" those standards 😉 I still think the best solution is just education about what key combinations can't be encoded ...
Author
Owner

@ghost commented on GitHub (Jun 18, 2020):

:tada:This issue was addressed in #6309, which has now been successfully released as Windows Terminal Preview v1.1.1671.0.🎉

Handy links:

@ghost commented on GitHub (Jun 18, 2020): :tada:This issue was addressed in #6309, which has now been successfully released as `Windows Terminal Preview v1.1.1671.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.1.1671.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Author
Owner

@zsimic commented on GitHub (Jan 7, 2021):

I noticed that latest 1.4.3243.0 seems to still be sending (as observed with showkey -a in an ubuntu wsl2 session):

  • 0x0d for enter
  • 0x0d also for shift+enter
  • 0x0a for ctrl+enter
  • nothing for ctrl+shift+enter

I worked around it by adding these actions to my settings.json:

{ "command": {"action": "sendInput", "input": "\u001b[13;2u" }, "keys": "shift+enter" },
{ "command": {"action": "sendInput", "input": "\u001b[13;5u" }, "keys": "ctrl+enter" },
{ "command": {"action": "sendInput", "input": "\u001b[13;6u" }, "keys": "ctrl+shift+enter" },

And similarly for shift+space:

{ "command": {"action": "sendInput", "input": "\u001b[32;2u" }, "keys": "shift+space" },
{ "command": {"action": "sendInput", "input": "\u001b[32;5u" }, "keys": "ctrl+space" },
{ "command": {"action": "sendInput", "input": "\u001b[32;6u" }, "keys": "ctrl+shift+space" },
@zsimic commented on GitHub (Jan 7, 2021): I noticed that latest 1.4.3243.0 seems to still be sending (as observed with `showkey -a` in an ubuntu wsl2 session): - `0x0d` for `enter` - `0x0d` also for `shift+enter` - `0x0a` for `ctrl+enter` - nothing for `ctrl+shift+enter` I worked around it by adding these actions to my `settings.json`: ``` { "command": {"action": "sendInput", "input": "\u001b[13;2u" }, "keys": "shift+enter" }, { "command": {"action": "sendInput", "input": "\u001b[13;5u" }, "keys": "ctrl+enter" }, { "command": {"action": "sendInput", "input": "\u001b[13;6u" }, "keys": "ctrl+shift+enter" }, ``` And similarly for `shift+space`: ``` { "command": {"action": "sendInput", "input": "\u001b[32;2u" }, "keys": "shift+space" }, { "command": {"action": "sendInput", "input": "\u001b[32;5u" }, "keys": "ctrl+space" }, { "command": {"action": "sendInput", "input": "\u001b[32;6u" }, "keys": "ctrl+shift+space" }, ```
Author
Owner

@adouzzy commented on GitHub (Aug 4, 2021):

I worked around it by adding these actions to my settings.json:

{ "command": {"action": "sendInput", "input": "\u001b[13;2u" }, "keys": "shift+enter" },
{ "command": {"action": "sendInput", "input": "\u001b[13;5u" }, "keys": "ctrl+enter" },
{ "command": {"action": "sendInput", "input": "\u001b[13;6u" }, "keys": "ctrl+shift+enter" },

This is gold.
with https://www.asciitable.com/ , you can set any combination on shortcuts.
My emacs is flying in the terminal now.
Huge thanks!

@adouzzy commented on GitHub (Aug 4, 2021): > I worked around it by adding these actions to my `settings.json`: > ``` > { "command": {"action": "sendInput", "input": "\u001b[13;2u" }, "keys": "shift+enter" }, > { "command": {"action": "sendInput", "input": "\u001b[13;5u" }, "keys": "ctrl+enter" }, > { "command": {"action": "sendInput", "input": "\u001b[13;6u" }, "keys": "ctrl+shift+enter" }, > ``` This is gold. with https://www.asciitable.com/ , you can set any combination on shortcuts. My emacs is flying in the terminal now. Huge thanks!
Author
Owner

@jbsilva commented on GitHub (Apr 4, 2023):

Same problem still happening in 2023 in Version: 1.12.10983.0.

{ "command": {"action": "sendInput", "input": "\u001b[13;2u" }, "keys": "shift+enter" },
{ "command": {"action": "sendInput", "input": "\u001b[13;5u" }, "keys": "ctrl+enter" },
{ "command": {"action": "sendInput", "input": "\u001b[13;6u" }, "keys": "ctrl+shift+enter" },

This worked for me.

@jbsilva commented on GitHub (Apr 4, 2023): Same problem still happening in 2023 in Version: 1.12.10983.0. > { "command": {"action": "sendInput", "input": "\u001b[13;2u" }, "keys": "shift+enter" }, > { "command": {"action": "sendInput", "input": "\u001b[13;5u" }, "keys": "ctrl+enter" }, > { "command": {"action": "sendInput", "input": "\u001b[13;6u" }, "keys": "ctrl+shift+enter" }, This worked for me.
Author
Owner

@CervEdin commented on GitHub (Apr 5, 2023):

I noticed that latest 1.4.3243.0 seems to still be sending (as observed with showkey -a in an ubuntu wsl2 session):

* `0x0d` for `enter`

* `0x0d` also for `shift+enter`

* `0x0a` for `ctrl+enter`

* nothing for `ctrl+shift+enter`

I worked around it by adding these actions to my settings.json:

{ "command": {"action": "sendInput", "input": "\u001b[13;2u" }, "keys": "shift+enter" },
{ "command": {"action": "sendInput", "input": "\u001b[13;5u" }, "keys": "ctrl+enter" },
{ "command": {"action": "sendInput", "input": "\u001b[13;6u" }, "keys": "ctrl+shift+enter" },

And similarly for shift+space:

{ "command": {"action": "sendInput", "input": "\u001b[32;2u" }, "keys": "shift+space" },
{ "command": {"action": "sendInput", "input": "\u001b[32;5u" }, "keys": "ctrl+space" },
{ "command": {"action": "sendInput", "input": "\u001b[32;6u" }, "keys": "ctrl+shift+space" },

I did this but then I started getting ;2u instead of space when lingering on the shift key while pressing space. Excluding shift + space did the trick.

@CervEdin commented on GitHub (Apr 5, 2023): > I noticed that latest 1.4.3243.0 seems to still be sending (as observed with `showkey -a` in an ubuntu wsl2 session): > > * `0x0d` for `enter` > > * `0x0d` also for `shift+enter` > > * `0x0a` for `ctrl+enter` > > * nothing for `ctrl+shift+enter` > > > I worked around it by adding these actions to my `settings.json`: > > ``` > { "command": {"action": "sendInput", "input": "\u001b[13;2u" }, "keys": "shift+enter" }, > { "command": {"action": "sendInput", "input": "\u001b[13;5u" }, "keys": "ctrl+enter" }, > { "command": {"action": "sendInput", "input": "\u001b[13;6u" }, "keys": "ctrl+shift+enter" }, > ``` > > And similarly for `shift+space`: > > ``` > { "command": {"action": "sendInput", "input": "\u001b[32;2u" }, "keys": "shift+space" }, > { "command": {"action": "sendInput", "input": "\u001b[32;5u" }, "keys": "ctrl+space" }, > { "command": {"action": "sendInput", "input": "\u001b[32;6u" }, "keys": "ctrl+shift+space" }, > ``` I did this but then I started getting `;2u` instead of space when lingering on the shift key while pressing space. Excluding `shift + space` did the trick.
Author
Owner

@revoconner commented on GitHub (Nov 25, 2025):

; Sends Ctrl+Shift+Enter when Claude Code is active, otherwise normal Shift+Enter

#Persistent
#SingleInstance force

; Shift+Enter hotkey
+Enter::
    WinGet, activeProcess, ProcessName, A
    WinGetTitle, activeTitle, A

    ; Check if Windows Terminal with Claude Code (title starts with U+2733)
    if (activeProcess = "WindowsTerminal.exe" && SubStr(activeTitle, 1, 1) = Chr(0x2733))
    {
        ; Claude Code is active - send Ctrl+Shift+Enter
        Send ^+{Enter}
    }
    else
    {
        ; Not Claude Code - pass through normal Shift+Enter
        Send +{Enter}
    }
return

I use this AHK script to send ctrl+shift+enter when I send shift+enter if the active window is WindowsTerminal.exe and has the claude code unicode character in it - U+2733

@revoconner commented on GitHub (Nov 25, 2025): ```AutoHotKey ; Sends Ctrl+Shift+Enter when Claude Code is active, otherwise normal Shift+Enter #Persistent #SingleInstance force ; Shift+Enter hotkey +Enter:: WinGet, activeProcess, ProcessName, A WinGetTitle, activeTitle, A ; Check if Windows Terminal with Claude Code (title starts with U+2733) if (activeProcess = "WindowsTerminal.exe" && SubStr(activeTitle, 1, 1) = Chr(0x2733)) { ; Claude Code is active - send Ctrl+Shift+Enter Send ^+{Enter} } else { ; Not Claude Code - pass through normal Shift+Enter Send +{Enter} } return ``` I use this AHK script to send ctrl+shift+enter when I send shift+enter if the active window is WindowsTerminal.exe and has the claude code unicode character in it - U+2733
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#784