-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ctrl+Break can leave the WSL shell in an unusable state #18425
Comments
Managed to reproduce the bug on version 1.21.3231.0 of windows terminal, and version 23H2 of windows 11. Bug also appears to go away if you enter vim, do :set mouse = a, then exit vim normally using :q. will investigate further later. |
You can also just type terminal/src/cascadia/TerminalConnection/ConptyConnection.cpp Lines 442 to 453 in 25392ea
It doesn't necessarily have to be be a hard reset, but at least a soft reset and then whatever additional modes are required to get the input back to normal. |
Thanks for filing! |
I'll fix this issue and submit a PR for it by this week. |
@carlos-zamora I tried running RestartConnection() from the command palette but it doesn't appear to fix the issue. What do you think of running the command "reset" when the user presses ctrl + break (but before the SIGKILL is sent), or after the user presses "enter" to restart? |
Fixed this issue in this PR |
Windows Terminal version
1.22.2702.0
Windows build number
10.0.19045.5247
Other Software
VIM 8.2.4919 (inside WSL)
Steps to reproduce
vim
.:set mouse=a
to enable mouse mode.press Enter to restart
message, press Enter.Expected Behavior
I'd expect mouse selection to work.
Actual Behavior
When you click in the window, nothing can be selected, but a bunch of "random" characters get entered at the prompt. It seems that Ctrl+Break kills the session without giving the app a chance to exit gracefully, and then when we restart the session we don't reset any of the VT state either. As a result we're left with a mouse mode enabled which the shell wasn't expecting.
This mouse mode example was just the easiest to demonstrate, but you can see how it could be even more annoying if the app had enabled something like win32 input mode, or had selected a graphic character set.
Note that for Windows console apps this is less of a problem, because they can trap the break and block it, or at least shut down more gracefully. But I don't think there is anything that Linux apps can do about this, because it's the WSL session itself that is being aborted (at least that's what appears to be happening).
The text was updated successfully, but these errors were encountered: