fix: send correct number of sequences for wheel scroll in alt buffer#5803
Closed
dolonet wants to merge 1 commit intoxtermjs:masterfrom
Closed
fix: send correct number of sequences for wheel scroll in alt buffer#5803dolonet wants to merge 1 commit intoxtermjs:masterfrom
dolonet wants to merge 1 commit intoxtermjs:masterfrom
Conversation
When the terminal is in the alt buffer (no scrollback), mouse wheel events are converted to up/down arrow key sequences. Previously only a single sequence was sent per wheel event regardless of how many lines were scrolled, making apps like less and man scroll much more slowly than expected. The touch scroll path (_handleTouchScrollAsKeys) already sends one sequence per line. Align the wheel path with the same behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5194
Problem
When the terminal is in the alt buffer (no scrollback — vim, less, man, etc.), mouse wheel events are converted to up/down arrow key sequences. Previously only a single sequence was sent per wheel event, regardless of how many lines the wheel reported scrolling. This made scrolling in alternate-screen apps feel sluggish — one notch of the wheel moved exactly one line instead of the expected three.
The same code path that handles touch scroll (
_handleTouchScrollAsKeys) already sends one sequence per line correctly. The wheel path was inconsistent with it.Fix
Loop
linestimes when sending the sequence, matching the existing touch scroll logic:linesis already computed by_consumeWheelEventjust above — no new state needed.Testing
Manually verified with
lessandman: one scroll click now moves the expected number of lines. The touch scroll path is unchanged.