Skip to content

Add support for modifier keys while scrolling in some terminals#766

Open
g-dg wants to merge 2 commits intomicrosoft:mainfrom
g-dg:horizontal_mouse_scroll
Open

Add support for modifier keys while scrolling in some terminals#766
g-dg wants to merge 2 commits intomicrosoft:mainfrom
g-dg:horizontal_mouse_scroll

Conversation

@g-dg
Copy link

@g-dg g-dg commented Feb 19, 2026

This PR adds support for the shift (horizontal scroll) and alt (fast scroll) key modifiers while scrolling. It also adds support for horizontal scroll wheels.

Unfortunately, it doesn't work in every terminal. Here are my testing results with some terminals:

Testing results with various terminals
Terminal Horizontal scroll wheel Shift + vertical scroll Alt + vertical scroll Alt + horizontal scroll wheel Alt + shift + vertical scroll Notes
Windows (Windows 11)
Windows Terminal only sends escape codes for regular and fast vertical scroll
Windows Console Host only sends escape codes for regular and fast vertical scroll
VSCode only sends escape codes for regular and fast vertical scroll
mintty shift + vertical scroll moves the cursor up and down (???) and shift + alt + vertical scroll moves the current line up and down
Linux (Arch with KDE on Wayland)
VSCode only sends escape codes for regular and fast vertical scroll
Alacritty
COSMIC Terminal horizontal scroll wheel is inverted
Ghostty scrolls very fast with precision scrolling, but this seems to also be a problem in other command-line utilities that support mouse scrolling
GNOME Console
GNOME Terminal
kitty
Konsole Holding shift while vertical scrolling doesn't change the scroll axis, and scrolling with horizontal scroll wheel does nothing except when holding alt which causes it to scroll vertically fast
LXTerminal
MATE Terminal
QTerminal Holding shift while vertical scrolling doesn't change the scroll axis, and scrolling with horizontal scroll wheel does nothing except when holding alt which causes it to scroll vertically fast
Xfce Terminal
XTerm Doesn't send escape codes for shift + scrolling

Not tested:

  • Mac OS

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.

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.

@g-dg g-dg changed the title Add horizontal scrolling with mouse wheel in some terminals Add support for modifier keys while scrolling in some terminals Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant