Add holding opt/alt for fast scrolling (#31056)

Fixes #14612

This was a feature I dearly missed from VSCode, so adding this helped me
migrate to Zed without disrupting my workflow. I found that `4.0` was a
nice goldilocks multiplier and felt close/the same as the speed in
VSCode.

Release Notes:

- Added faster scrolling in the editor while holding opt/alt
This commit is contained in:
Alistair Smith 2025-05-26 12:42:20 -07:00 committed by GitHub
parent ee415de45f
commit 5bafb2b160
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 1 deletions

View file

@ -6339,9 +6339,23 @@ impl EditorElement {
// Set a minimum scroll_sensitivity of 0.01 to make sure the user doesn't
// accidentally turn off their scrolling.
let scroll_sensitivity = EditorSettings::get_global(cx).scroll_sensitivity.max(0.01);
let base_scroll_sensitivity =
EditorSettings::get_global(cx).scroll_sensitivity.max(0.01);
// Use a minimum fast_scroll_sensitivity for same reason above
let fast_scroll_sensitivity = EditorSettings::get_global(cx)
.fast_scroll_sensitivity
.max(0.01);
move |event: &ScrollWheelEvent, phase, window, cx| {
let scroll_sensitivity = {
if event.modifiers.alt {
fast_scroll_sensitivity
} else {
base_scroll_sensitivity
}
};
if phase == DispatchPhase::Bubble && hitbox.is_hovered(window) {
delta = delta.coalesce(event.delta);
editor.update(cx, |editor, cx| {