-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Alt-Backspace followed by Enter does not behave properly #2746
Comments
Looks like we're carrying the Alt key state through to the next
|
Looks like recrudescence of #1209 |
The InputStateMachineEngine was incorrectly not returning to the ground state after flushing the last sequence. That means that something like alt+backspace would leave us in the Escape state, not the ground state. This makes sure we return to ground. Fixes #2746. Additionally removes the "Parser.UnitTests-common.vcxproj" file, which was originally used for a theoretical time when we only open-sourced the parser. It's unnecessary now, and we can get rid of it. Also includes a small patch to bcz.cmd, to make sure bx works with projects with a space in their name.
## Summary of the Pull Request The InputStateMachineEngine was incorrectly not returning to the ground state after flushing the last sequence. That means that something like alt+backspace would leave us in the Escape state, not the ground state. This makes sure we return to ground. Additionally removes the "Parser.UnitTests-common.vcxproj" file, which was originally used for a theoretical time when we only open-sourced the parser. It's unnecessary now, and we can get rid of it. Also includes a small patch to bcz.cmd, to make sure bx works with projects with a space in their name. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #2746 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated <hr> * Return to ground when we flush the last char The InputStateMachineEngine was incorrectly not returning to the ground state after flushing the last sequence. That means that something like alt+backspace would leave us in the Escape state, not the ground state. This makes sure we return to ground. Fixes #2746. Additionally removes the "Parser.UnitTests-common.vcxproj" file, which was originally used for a theoretical time when we only open-sourced the parser. It's unnecessary now, and we can get rid of it. Also includes a small patch to bcz.cmd, to make sure bx works with projects with a space in their name. * Update src/terminal/parser/stateMachine.cpp Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com> * add the comment @miniksa wanted
🎉This issue was addressed in #2823, which has now been successfully released as Handy links: |
Hey! The fix for this went out in Windows in the Insider channel's Fast Ring with build 19013. It's worked in Windows Terminal since v0.6, and now it'll work in other terminals using ConPTY on Windows. |
Pressing Alt+Backspace, then some other characters, followed by Enter will not trigger the right inputs for a shell through WSL. This issue is pretty subtle and it can be tricky to observe in my experience, so I have 2 test cases below to demonstrate this issue.
Environment
Test case 1
Steps to reproduce
echo foo
(don't press Enter)echo
)bar
(the command should now readecho bar
)Expected behavior
bar
should be printed. This is the behavior when using WSL via vanilla Command Prompt, or using GNOME Terminal on a standalone Linux distro.Actual behavior
Nothing happens. Pressing Alt+Backspace then pressing Enter inputs an escape sequence that would be expected from Alt+Enter, which Bash silently ignores by default.
To see this more visibly, run
bind -x '"\e\r":"echo whoops"'
then repeat the above steps. Now,whoops
will be printed, since the above steps will input the escape sequence for Alt+Enter (\e\r
).Test case 2
Steps to reproduce
cat > sample.txt
foo
followed by Alt+Backspace followed bybar
followed by Enterhexdump -C sample.txt
Expected behavior
hexdump
should print the following output:This is the behavior when using WSL via vanilla Command Prompt, or using GNOME Terminal on a standalone Linux distro.
Actual behavior
hexdump
prints the following output:Just like before, we can see the sequence for Alt+Enter (
\e\r
, or1b 0a
in hex) is actually registered where we expected to see just\r
(0a
in hex).The text was updated successfully, but these errors were encountered: