-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Terminal] VT Mouse Support #545
Comments
Yea, this is a known issue at the moment. We need to add support for mouse in two places: both in the terminal, to be able to synthesize mouse sequences, and in conpty to be able to read mouse sequences. This issue is tracking the first bit, the Terminal functionality. For the second bit, the conpty part, see #376. |
Sadly this does not work, having the mouse events with TMUX would defer the need to have multiple panes. |
I would like to point out that the mouse support is also not supported in tmux within Docker (through Powershell). I know this is because the functionality simply isn't there in Terminal so of course it won't work in WSL or Docker, but thought I'd go ahead and mention it. |
the mouse does work with TMUX in WSL |
Mouse works with wsltty: https://github.com/mintty/wsltty |
@guibirow Maybe it's an issue with Docker from within Terminal then. |
No. It's not an issue with Docker. It's an issue with conpty (this repo). Try wsltty if you want mouse support. |
Are there plans to enable full mouse support in tmux for Docker in the future through Terminal? |
I don't know about Docker specifically, but i don't see why it should be any different than a normal terminal. This issue is about that, so keep an eye out! |
So I just checked tmux through WSL 1 in Terminal and the mouse isn't supported there either. So my guess is that tmux itself just doesn't work in Terminal at this point and that it's not a Docker issue. Not sure what @guibirow was seeing on his end. |
You have to run a command to enable it, isn't enabled by default. It only works on wsl terminal though, not in the new windows terminal |
Oh I gotcha. Yeah it works fine in the plain WSL window. It only fails to work when embedded within the new Windows Terminal. |
If you implement mouse support, please make sure to implement the SGR (1006) extension as well. The legacy, byte-based protocol only allows row and column numbers up to 223, because 32 is added to this number and this is sent as a single byte. The column limit is not uncommon to be too small. (By the way, beginning at column 95 the generated data is not 7-bit clean and not valid UTF-8 which is a problem for encoding conversion layers such as luit.) The SGR 1006 extension fixes these problems by encoding the numbers as decimal digits, and is supported by plenty of applications. If this extension is not requested, please don't generate any event if the row or column exceeds 223. Otherwise an overflow could have nasty consequences. E.g. clicking on column 227 could generate the byte 32+227 = 259 = 3 = Ctrl+C which is typically the interrupt character sending a SIGINT to the running process. |
So! Conhost actually does support DECSET |
To clarify, because we have conhost in the middle, that would look like this:
|
Did you mean 1005 between the application and conhost, or is that a typo in this picture? Mouse extensions 1005 and 1015 also exist but they are hardly used (if at all) due to their flaws, it's not something that applications are interested in. 1005 (xterm's two-byte UTF-8), 1015 (urxvt) and 1006 (xterm SGR), in this chronological order, are three mutually exclusive extensions to address the limitation of the column number. See e.g. Midnight Commander issues 2662 and 2956 for technical description about the flaws of the first two. Note that this story is now 6-8 years old. I'm not aware of any application that supports the problematic 1005 and/or 1015 but not the okay 1006. As such, I don't see any point in implementing support for the first two (although it should be very easy to implement them). |
That very well could be a typo, right now, conhost actually supports a bunch of different mouse modes, including, but not limited to 1005 and 1006. |
## Summary of the Pull Request Make TerminalControl synthesize mouse events and Terminal send them to the TerminalInput's MouseInput module. The implementation here takes significant inspiration from how we handle KeyEvents. ## References Closes #545 - VT Mouse Mode (Terminal) References #376 - VT Mouse Mode (ConPty) ### TerminalControl - `_TrySendMouseEvent` attempts to send a mouse event via TermInput. Similar to `_TrySendKeyEvent` - Use the above function to try and send the mouse event _before_ deciding to modify the selection ### TerminalApi - Hookup (re)setting the various modes to handle VT Input - Terminal is _always_ in VT Input mode (important for #4856) ### TerminalDispatch - Hookup (re)setting the various modes to handle VT Input ### TerminalInput - Convert the mouse input position from viewport position to buffer position - Then send it over to the MouseInput in TerminalInput to actually do it (#4848) ## Validation Steps Performed Tests should still pass.
How do we copy the text when VT Mouse is enabled? I couldn't do it on Vim or Tmux. |
Hold down shift to interact with the terminal itself instead of the application inside it. |
This is so great! When will we see a preview of this in the Store? |
Stay tuned |
Downloaded from the shop! The mouse is working great in VIM, htop and Tmux. Finally, time to move from all other WSL Terminal to the microsoft one ! Good job guys and thanks a lot ! PS: shift is working great too ! |
Just came here looking for why mouse wasn't working ... read the most recent comment from @yveslange and then updated the app ... and now mouse works perfect. Thanks guys! |
@DHowett-MSFT : Mouse still doesn't work for me with Micro (https://github.com/zyedidia/micro), whereas both mouse and scrollwheel work flawlessly in the default powershell or cmd.exe terminal. Is mouse support only working in WSL for now ? |
@zadjii-msft Edit: Or is that just a result of PowerShell/Win32-OpenSSH#1310 and would work otherwise? |
This is a result of PowerShell/Win32-OpenSSH#1310, which is (mercifully) fixed in the 8.x series. |
@DHowett-MSFT Thanks for the quick reply. In that case, is there a sane way to manually upgrade to a version with the fix right now or is it better to just wait? |
Sure, just download the latest release from their Releases page! |
I don't see it here or in the documentation, but how do you turn this behavior off entirely? It's incredibly annoying for people who don't want to have mouse interactions pass through. Holding shift is not a good option. |
@rfc805 there isn't a setting to disable this entirely - I'm not sure I've heard anyone request that before. Typically this is something that's controlled per-client application on other platforms, within the app's own config. Is there some app ( |
It's mostly vim (over ssh) but on a large variety of hosts which aren't related, which makes it non-trivial to globally disable in unlinked/unshared profiles across a few hundred different remote hosts. A lot of it involves copying data from those hosts across each other, or to other Windows apps, etc - so I find myself holding shift down my whole life if I use terminal instead of putty/mintty. |
You know, this actually already is on the backlog. I'd go upvote #4875 |
Thanks - I do know how to do it each time, just overall a productivity killer if you work in a large environment with a profile you do not control. |
ver
at a Windows Command Prompt)10.0.18890.1000
I routinely use mouse mode in tmux with WSL for window selection, pane resizing, and scrollback, enabled in tmux.conf thus:
While this works perfectly in conhost, it does not work at all in Terminal; nothing happens, as if the mouse events were never reaching tmux.
tmux mouse support (and presumably other mouse-supporting applications) should work as they do in conhost.
The text was updated successfully, but these errors were encountered: