-
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
[Conpty] Pass through request for mouse mode to the Terminal #9970
Conversation
src/host/getset.cpp
Outdated
gci.GetActiveInputBuffer()->PassThroughEnableButtonEventMouseMode(true); | ||
gci.GetActiveInputBuffer()->PassThroughEnableSGRExtendedMouseMode(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only sending these 2 VT sequences seems to make far manager work, but I am not sure if we should be sending other VT sequences through as well/in different cases (like only button events versus all mouse events), since the console mode only has 1 umbrella ENABLE_MOUSE_INPUT
mode and not more specific ones as far as I know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try if Win32 Vim works? The lacking of mouse support in Win32 Vim is the root cause of several issues. It also drives me to NeoVim personally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want 1003 instead of 1002 -- that's the "any event" mode which includes hover (the win32 event model automatically reports hover!)
2 outstanding issues:
|
src/host/getset.cpp
Outdated
gci.GetActiveInputBuffer()->PassThroughEnableButtonEventMouseMode(true); | ||
gci.GetActiveInputBuffer()->PassThroughEnableSGRExtendedMouseMode(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try if Win32 Vim works? The lacking of mouse support in Win32 Vim is the root cause of several issues. It also drives me to NeoVim personally.
The issues with powershell and WSL have been resolved (as far as I can tell), so I've marked this PR ready for review now. However, certain applications (like vim) will still not work because they do not turn off quick edit mode. |
@msftbot make sure @zadjii-msft and @miniksa sign off |
Hello @DHowett! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
I want @zadjii-msft to sign off because he probably has an opinion about InputBuffer having hardcoded VT sequences in it, and I want @miniksa to sign off because he probably has an opinion about whether this is the correct thing to do in general. Both Mikes are equipped to have that second opinion, but since this is closer to the conhost side... you know. 😄 |
wait then how the heck does mouse ever work in |
IT SURE DOES Check out the dates on this mailing list post (view in a private browsing tab so Google's panopticon can't force you to log in.) |
Wow, what a history lesson. Well, I suppose that's on the or is the hot take that conpty should have QE disabled by default (since QE _doesn't really make sense in conpty)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea that's a nit. Just don't want the notes to get lost if we ever move the repo again and break the git blame
in 20 years.
hot take 2: should we make a PR to cold take 3: We should add a troubleshooting paragraph to the docs page that explains
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah OK. It's still mildly confusing to understand why this works just from the code itself... but the link back to this pull I guess is as good as we can do here. We've definitely done stuff like this before, so I don't have any reason to block it if it helps compatibility broadly.
Hello @PankajBhojwani! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Hi, do you have development builds where I can try this out? |
🎉 Handy links: |
re: vim.exe quickedit mode; I understand that vim doesn't turn it off, but! |
All fair questions. ConPTY ignores any registry settings, even for the console defaults, because it's intended to provide a console interface that acts the same on all machines regardless of user configuration (so that the hosting terminal can make the final call about a number of things). It then follows that it defaults to on because that's what it does in an unconfigured conhost 😄 The problem now, though, is this:
|
The Windows conpty layer now allows terminal emulators other than the classic conhost.exe to host win32 console applications that use mouse events. For mouse events to function correctly, mouse input needs to be enabled and quick edit mode needs to be disabled. This commit teaches vim to make this change when it enables mouse mode. I have no special knowledge of vim, and this patch is roughly based on the suggested changes in this discussion: https://groups.google.com/g/vim_dev/c/bQ7jfMwa8Zg The intent is to enable mouse input and disable quickedit when enabling mouse mode, and to disable mouse input and restore the prior quickedit mode state when mouse mode is disabled. refs: microsoft/terminal#9970
Makes sense! tricky! |
The Windows conpty layer now allows terminal emulators other than the classic conhost.exe to host win32 console applications that use mouse events. For mouse events to function correctly, mouse input needs to be enabled and quick edit mode needs to be disabled. This commit teaches vim to make this change when it enables mouse mode. I have no special knowledge of vim, and this patch is roughly based on the suggested changes in this discussion: https://groups.google.com/g/vim_dev/c/bQ7jfMwa8Zg The intent is to enable mouse input and disable quickedit when enabling mouse mode, and to disable mouse input and restore the prior quickedit mode state when mouse mode is disabled. refs: microsoft/terminal#9970
🎉 Handy links: |
And it got merged!, now Win32 Vim supports mouse input. |
Summary of the Pull Request
When the client application sets the console input mode with the
ENABLE_MOUSE_INPUT
flag, we send along the appropriate VT sequences to the connected terminal (if there is one).References
#376
#6859
PR Checklist
Validation Steps Performed
Far manager works