Skip to content

Add better scroll wheel support and option to disable acceleration #1566

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

Merged
merged 1 commit into from
Feb 23, 2025

Conversation

ychin
Copy link
Member

@ychin ychin commented Feb 23, 2025

macOS applies a acceleration to the mouse scroll wheel which is often frustrating to use. In particular, a single click on the scroll wheel generates a fractional scroll, which doesn't do anything in MacVim as it scrolls by line. Fix this by forcing each scroll event to scroll at least one line (this is configurable to be higher, or 0 which means use the old behavior).

Also add an option to simply turn off acceleration and scroll a fixed number of lines.

Also, fix horizontal scrolling using mouse wheel. In macOS, the way to scroll horizontally using a normal wheel is to hold Shift key and scroll, and the OS will convert that to a horizontal scroll event. However, we were sending the shift modifier to Vim as well, which interprets it as which is not what we want (this scrolls a whole page). We manually remove the shift modifier when we detect this. It does mean there's functionally no way to send shift-scroll wheel events to Vim, but it is ok, as macOS generally works this way and it's consistent with how native GUI apps work.

@ychin ychin added the Input Issues related to keyboard or other types of input label Feb 23, 2025
@ychin ychin added this to the Release 182 milestone Feb 23, 2025
macOS applies a acceleration to the mouse scroll wheel which is often
frustrating to use. In particular, a single click on the scroll wheel
generates a fractional scroll, which doesn't do anything in MacVim as it
scrolls by line. Fix this by forcing each scroll event to scroll at
least one line (this is configurable to be higher, or 0 which means use
the old behavior).

Also add an option to simply turn off acceleration and scroll a fixed
number of lines.

Also, fix horizontal scrolling using mouse wheel. In macOS, the way to
scroll horizontally using a normal wheel is to hold Shift key and
scroll, and the OS will convert that to a horizontal scroll event.
However, we were sending the shift modifier to Vim as well, which
interprets it as <S-ScrollWheelRight> which is not what we want (this
scrolls a whole page). We manually remove the shift modifier when we
detect this. It does mean there's functionally no way to send
shift-scroll wheel events to Vim, but it is ok, as macOS generally works
this way and it's consistent with how native GUI apps work.
@ychin ychin force-pushed the mouse-wheel-disable-acceleration branch from 373d403 to 95a3120 Compare February 23, 2025 06:28
@ychin ychin merged commit b7717d5 into macvim-dev:master Feb 23, 2025
5 checks passed
@ychin ychin deleted the mouse-wheel-disable-acceleration branch February 23, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Input Issues related to keyboard or other types of input
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant