Skip to content

pager: add opt-in mouse wheel scrolling to streampager - #1366

Open
DurhamG wants to merge 1 commit into
facebook:mainfrom
DurhamG:pager-mouse-scroll
Open

pager: add opt-in mouse wheel scrolling to streampager#1366
DurhamG wants to merge 1 commit into
facebook:mainfrom
DurhamG:pager-mouse-scroll

Conversation

@DurhamG

@DurhamG DurhamG commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary:
This adds a pager.mouse config option, off by default, that turns mouse reporting on and scrolls the output three lines per wheel click.

It is off by default because it interferes with normal terminal selection and copying behavior.

The option is named pager.mouse even though it only affects streampager, because that is what the existing options do (pager.wrapping-mode, pager.interface, etc). The new config is documented as "Only affects streampager".

The display event loop turns a wheel event into the same scroll actions the key bindings already use. That loop checks the config option rather than relying on mouse events not arriving at all, because on Windows termwiz always puts the console into mouse-input mode, so wheel events show up even when the user did not ask us to handle the mouse.

Sapling passes the option in when it builds the pager rather than through a setter, because the value decides which terminal capabilities the pager is created with. streampager also reads the option from an SP_MOUSE environment variable for use outside Sapling, matching the existing SP_INTERFACE_MODE and SP_SCROLL_PAST_EOF.

Tested by hand on Windows and macOS with sl help config --config pager.mouse=true and sl help config --config pager.mouse=false, confirming the wheel scrolls only when it is on.

Summary:
This adds a `pager.mouse` config option, off by default, that turns mouse
reporting on and scrolls the output three lines per wheel click.

It is off by default because it interferes with normal terminal selection and
copying behavior.

The option is named `pager.mouse` even though it only affects streampager,
because that is what the existing options do. `pager.scroll-past-eof`,
`pager.wrapping-mode`, `pager.interface` and `pager.separate-stderr` are all
streampager-only and all live under `pager.`, each documented as "Only affects
streampager". There is no separate config section for streampager.

The display event loop turns a wheel event into the same scroll actions the key
bindings already use. That loop checks the config option rather than relying on
mouse events not arriving at all, because on Windows termwiz always puts the
console into mouse-input mode, so wheel events show up even when the user did
not ask us to handle the mouse.

Sapling passes the option in when it builds the pager rather than through a
setter, because the value decides which terminal capabilities the pager is
created with. streampager also reads the option from an SP_MOUSE environment
variable for use outside Sapling, matching the existing SP_INTERFACE_MODE and
SP_SCROLL_PAST_EOF.

Tested by hand on Windows and macOS with `sl help config --config
pager.mouse=true` and `sl help config --config pager.mouse=false`, confirming
the wheel scrolls only when it is on.
@meta-cla meta-cla Bot added the CLA Signed label Jul 22, 2026
@DurhamG

DurhamG commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

AI was used in the making of this commit.

@meta-codesync

meta-codesync Bot commented Jul 22, 2026

Copy link
Copy Markdown

This pull request has been imported. If you are a Meta employee, you can view this in D113281664. (Because this pull request was imported automatically, there will not be any future comments.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant