-
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
Vim/Neovim/tmux scroll way too fast with trackpads #6184
Comments
FWIW, I dug up a mouse I had lying around and tried scrolling with the mouse wheel. It worked perfectly, so I'm guessing this is an issue with trackpad support for scrolling in the Windows Terminal? |
This seems just like the earlier issue we had where trackpads would scroll the Terminal buffer entirely too fast. I bet we're using the lines to scroll value from the system for scrolling the buffer, but not the VT mouse events we generate. |
Makes sense. Thanks for the quick response! Looking forward to seeing this one close so I can switch over to using the Terminal. |
FWIW, this is somewhat worse with WSL2, since WSL2 broke (secure) X server communication from the Linux guest to the Windows host, and so it's unsafe to run Linux-based GUI terminals now. I switched back to wsltty, but even that has some awkward scrolling bugs when used with trackpads (the beginning of the swipe up is treated as an up arrow, which cycles history in most shells). AFAICT there aren't any terminals on Windows anymore that work with WSL and trackpads. |
Alright, I’m taking this on. Gonna move delta accumulation into the shared mouse input code so both conhost and terminal benefit from it. |
By storing up the accumulated delta in the mouse input handler, we can enlighten both conhost and terminal about wheel events that are less than one line in size. Previously, we had a workaround in conhost that clamped small scroll deltas to a whole line, which made trackpad scrolling unimaginably fast. Terminal didn't make this mistake, but it also didn't handle delta accumulation . . . which resulted in the same behavior. MouseInput will now wait until it's received WHEEL_DELTA (well-known constant, value 120) worth of scrolling delta before it dispatches a single scroll event. Future considerations may include sending multiple wheel button events for every *multiple* of WHEEL_DELTA, but that would be a slightly larger refactoring that I'm not yet ready to undertake. There's a chance that we should be dividing WHEEL_DELTA by the system's "number of lines to scroll at once" setting, because on trackpads conhost now scrolls a little _slow_. I think the only way to determine whether this is palatable is to just ship it. Fixes #6184.
By storing up the accumulated delta in the mouse input handler, we can enlighten both conhost and terminal about wheel events that are less than one line in size. Previously, we had a workaround in conhost that clamped small scroll deltas to a whole line, which made trackpad scrolling unimaginably fast. Terminal didn't make this mistake, but it also didn't handle delta accumulation . . . which resulted in the same behavior. MouseInput will now wait until it's received WHEEL_DELTA (well-known constant, value 120) worth of scrolling delta before it dispatches a single scroll event. Future considerations may include sending multiple wheel button events for every *multiple* of WHEEL_DELTA, but that would be a slightly larger refactoring that I'm not yet ready to undertake. There's a chance that we should be dividing WHEEL_DELTA by the system's "number of lines to scroll at once" setting, because on trackpads conhost now scrolls a little _slow_. I think the only way to determine whether this is palatable is to just ship it. Fixes #6184.
@reissbaker thanks for spurring us into action. 😄 |
By storing up the accumulated delta in the mouse input handler, we can enlighten both conhost and terminal about wheel events that are less than one line in size. Previously, we had a workaround in conhost that clamped small scroll deltas to a whole line, which made trackpad scrolling unimaginably fast. Terminal didn't make this mistake, but it also didn't handle delta accumulation . . . which resulted in the same behavior. MouseInput will now wait until it's received WHEEL_DELTA (well-known constant, value 120) worth of scrolling delta before it dispatches a single scroll event. Future considerations may include sending multiple wheel button events for every *multiple* of WHEEL_DELTA, but that would be a slightly larger refactoring that I'm not yet ready to undertake. There's a chance that we should be dividing WHEEL_DELTA by the system's "number of lines to scroll at once" setting, because on trackpads conhost now scrolls a little _slow_. I think the only way to determine whether this is palatable is to just ship it. Fixes #6184. (cherry picked from commit fc08329)
🎉This issue was addressed in #6843, which has now been successfully released as Handy links: |
1 similar comment
🎉This issue was addressed in #6843, which has now been successfully released as Handy links: |
🎉This issue was addressed in #6843, which has now been successfully released as Handy links: |
Yesssss thank you! 😁 Edit: tried out the Preview build, works perfectly! |
Happy to hear it. Thanks for letting us know! |
Environment
Windows Terminal version
1.0.1401.0
.I'm curious whether or not this is trackpad-related, so FWIW I'm using a Surface Book and scrolling with the trackpad.
EDIT: I tried with a normal mouse plugged into the USB port instead of the trackpad, and it's definitely trackpad-related: regular mouse wheels work just fine.
Steps to reproduce
tmux
set up with:And/or Neovim (or just plain old Vim) with:
Expected behavior
The above snippets make
vim
,nvim
, andtmux
able to be scrolled with the mouse/trackpad on macOS and Linux. They also work in WSL... If I use Xming to run an X server, and use urxvt as my terminal emulator. So, I'd expect that they'd also work for Windows Terminal.They work in all of the above either alone (e.g. Vim/Neovim not nested inside
tmux
), or nested (e.g. running Neovim insidetmux
).Actual behavior
For some reason with the Windows Terminal, when I scroll in vim/nvim/tmux (with the editors either nested in
tmux
or un-nested) they all go absolutely nuts and scroll at like 10x speed, which is kind of unusable. FWIW I'm using a Surface Book and scrolling with my trackpad, if that makes a difference? It looks like it's just sending way more scroll events to the terminal than it should be.Windows Terminal is otherwise dope and I'd love to be able to replace my janky Xming + urxvt setup for coding on Windows.
Here's a video I captured of the behavior in
tmux
— I tried to scroll a very small amount, and instead it scrolled 78 rows:The text was updated successfully, but these errors were encountered: