Skip to content

feat: ctrl+wheel font-size zoom#1613

Open
atreidesend wants to merge 1 commit into
raphamorim:mainfrom
atreidesend:feat/ctrl-wheel-zoom
Open

feat: ctrl+wheel font-size zoom#1613
atreidesend wants to merge 1 commit into
raphamorim:mainfrom
atreidesend:feat/ctrl-wheel-zoom

Conversation

@atreidesend
Copy link
Copy Markdown

Closes #792.

Ctrl+mouse-wheel zooms the font size, matching WezTerm, Windows Terminal, iTerm, and similar terminals. The feature has been requested since November 2024.

Hooks into the existing MouseWheel::LineDelta arm: when Ctrl is held (and Shift is not, and the focused app is not in mouse-reporting mode), wheel-up calls change_font_size(Increase) and wheel-down calls Decrease, reusing the handler the keyboard shortcuts already use. Mouse-reporting mode (tmux mouse on, vim :set mouse=a) is respected so wheel events still pass through unchanged when the inner app wants them.

Touchpad (PixelDelta) input intentionally falls through to the existing scroll path. Touchpad gestures fire many small deltas per swipe, and wiring zoom into them naively gives ~12 zoom steps per swipe; a debounced/threshold-based variant is worth a follow-up once the simpler wheel case is in.

Opt out via:

[mouse]
wheel-zoom = false

Defaults to true so the feature is discoverable.

Verified locally on Windows 11.

Aside: main (at a7766425b0, "update to wgpu 29.0.3") currently fails to build on Windows MSVC because of a windows crate version conflict between wgpu-hal 29.0.3 (uses windows 0.62) and gpu_allocator (still on 0.54) in the dx12 backend. This change was developed and tested against v0.4.5 and applies cleanly. Happy to file a separate issue for the build break if it'd help.

Ctrl+mouse-wheel for live font-size zoom is standard in WezTerm,
Windows Terminal, iTerm, and similar terminals. Issue raphamorim#792 has tracked
the feature request since November 2024.

Hooks into the existing MouseWheel LineDelta path: when Ctrl is held
(and Shift is not, and the focused app is not in mouse-reporting
mode), wheel-up calls change_font_size(Increase) and wheel-down calls
Decrease, reusing the handler the keyboard shortcuts already use.
Mouse-reporting mode (tmux mouse on, vim mouse) is respected so wheel
events still pass through unchanged when the inner app wants them.

Touchpad (PixelDelta) input intentionally falls through to default
scroll behaviour. Touchpad gestures fire many small deltas per swipe;
a debounced/threshold-based zoom is worth a follow-up once the simpler
mouse-wheel case is in.

Opt out via:

    [mouse]
    wheel-zoom = false

Defaults to on so the feature is discoverable.

Closes raphamorim#792.
@atreidesend
Copy link
Copy Markdown
Author

Quick note on the red checks here — I don't think they're related to this change. The msys2-build-test and Nix Build jobs are failing on an MSRV mismatch:

error: rustc 1.95.0 is not supported by the following packages:
  rio-notifier@0.4.6 requires rustc 1.96.0
  rioterm@0.4.6 requires rustc 1.96.0

It looks like this traces back to 6a11aa33c7 ("update to rust 1.96"), which bumped the workspace rust-version to 1.96.0. The msys2 toolchain currently ships rustc 1.95.0, and the Nix build reports No stable 1.96.* is available, so both fail before compiling anything. The same jobs are red on main independently of this PR.

The three test-native jobs (Windows/macOS/Linux) — which actually build and test the change — are passing. This diff doesn't touch any Cargo.toml, dependencies, or the MSRV, so I believe it's unaffected. Happy to rebase once the toolchain situation settles, and of course glad to adjust anything in the change itself.

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.

Doesn't zoom in/out on Ctrl + mouse wheel

1 participant