malxau / yori

Yori is a CMD replacement shell that supports backquotes, job control, and improves tab completion, file matching, aliases, command history, and more.
http://www.malsmith.net/yori/
MIT License
1.23k stars 30 forks source link

Scrolling with mouse wheel in Windows Terminal isn't working unless you hold down Shift while scrolling #99

Closed mross002 closed 2 years ago

mross002 commented 2 years ago

I'm not sure if this is due to some settings on my machine or what, but when using Yori within Windows Terminal, I'm unable to scroll up or down using the mouse wheel, however, if I hold down the Shift key and then scroll with the mouse wheel then it works, though when scrolling while holding Shift it seems that highlighting, selecting text, ctrl+click, etc. do not work if the text is in an area that is not within the current active area (i.e. not within the area displayed on screen before you scrolled up) - may want to break this behavior out to a separate issue. I do not see this behavior when using cmd or posh within WT, or when running Yori as a stand alone executable, only when running Yori within WT.

Yori version: 1.60 Windows Terminal version: 1.10.2383.0

malxau commented 2 years ago

Are you setting YORIQUICKEDIT=1 ?

The basic issue is that mouse events are either handled by Terminal or by Yori (never both.) In conhost, Yori can see the entire history within the window, so it can handle mouse wheel events and move the viewport. In Terminal, this information is not provided, so Yori has no way to respond to mouse wheel events. See https://github.com/microsoft/terminal/issues/10191 and in particular https://github.com/microsoft/terminal/issues/10191#issuecomment-881206401 (the Edit: text at the end.) Holding down Shift tells Terminal to handle the events and not send them to Yori, which is why that works.

The issue about Ctrl+click and selection is related. Because Terminal doesn't let applications see anything that's not part of the current viewport, there's no way for Yori to handle Ctrl+click except for regions that are currently visible (without scrolling.)

Yori gives you the choice about which process should handle the mouse, and realistically if using Terminal, Terminal should handle mouse events. It currently doesn't provide enough support for Yori to handle them well.

mross002 commented 2 years ago

Thanks for your response @malxau - appreciate it - yes I have YORIQUICKEDIT=1, I deleted it and you are correct it resolves the issue with scrolling, but without it the ctrl+click behavior to select values (probably my most used Yori feature) doesn't work at all within WT. So if I'm reading your response correctly and it's one or the other, I will probably keep YORIQUICKEDIT=1 (or only use Yori outside of WT), as the benefits outweigh the reported issue (in my opinion).

Regarding holding down shift to tell Terminals to respond to events and not send them to Yori, are you aware of any way to do the opposite, i.e. have Terminals handle events unless I hold down an additional shortcut key, in which case Yori would handle the events? If so then that would provide the best of both (in my case at least), I'm not married to ctrl being the modifier for selecting values, holding down ctrl+shift as an example when needing to select values with the mouse wouldn't be much of an issue in terms of usability.

malxau commented 2 years ago

I'm afraid I don't know of key combinations to have Terminal handle mouse events by default and only send them to applications via a key modifier. You might want to ask the Terminal folks if one exists - I don't see it in their documentation but they may already have it or be open to creating one.