Scroll sideways while holding the shift key and scroll fast while holding the alt key#766
Scroll sideways while holding the shift key and scroll fast while holding the alt key#766g-dg wants to merge 2 commits intomicrosoft:mainfrom
Conversation
900787d to
c06b1ea
Compare
|
Also, I just saw that your PR is from Feb 20. I apologize that I ignored it - I'm not actually sure why. I love the test matrix btw! |
| mouse.scroll.x += if (btn & 0x01) != 0 { 7 } else { -7 } * scroll_mult; | ||
| } else { | ||
| mouse.scroll.y += if (btn & 0x01) != 0 { 3 } else { -3 } * scroll_mult; | ||
| } |
There was a problem hiding this comment.
This multiplication logic should go into tui.rs. Specifically, here:
Line 623 in 3afb4f7
(You need to make
next_scroll a mutable variable for that.)
The reason for that is that input.rs' only concern is providing platform-independent input events. When we later add a fully customizable key binding editor, your key bindings should still have almost raw access to the input events. This allows a user to e.g. change the multiplier when Shift/Alt is held during scrolling.
Right now, all of the key binding logic is hardcoded in tui.rs, so it makes sense if these two key bindings also go there.
There was a problem hiding this comment.
Sounds good. Would it also be a good idea to move the base scroll amounts (3 lines & 7 characters) to tui.rs as well?
I think that if fast scroll multiplication should be abstracted in the TUI layer, then the base scroll amounts should probably also be abstracted in the TUI layer.
|
@microsoft-github-policy-service agree |

This PR adds support for the shift (horizontal scroll) and alt (fast scroll) key modifiers while scrolling.
Unfortunately, it doesn't work in every terminal. Here are my testing results with some terminals:
Testing results with various terminals
Not tested:
I didn't try any other terminal mouse tracking modes. For all I know, there may be one that gets more terminals to work, but changing it will probably mess up a whole bunch of other stuff.
This does change the side-scrolling from 3 characters to 7 characters. Scrolling horizontally by 7 characters seems to be about the same as what VS Code does and fast scrolling is a 5x multiplier by default in VS Code. I wouldn't mind other people's opinions on these values though.
Cool project, BTW.