From c06b1ea880197921174212a43586fb9ccc4f7236 Mon Sep 17 00:00:00 2001 From: Garnet DeGelder Date: Wed, 29 Apr 2026 17:12:00 -0400 Subject: [PATCH 1/2] Update to latest changes --- crates/edit/src/input.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/edit/src/input.rs b/crates/edit/src/input.rs index a0dfd840844..31752379628 100644 --- a/crates/edit/src/input.rs +++ b/crates/edit/src/input.rs @@ -569,10 +569,13 @@ impl<'input> Stream<'_, '_, 'input> { // I know there's an InputMouseState::Release, but that's because the internals of tui.rs // have leaked into intput.rs. input.rs indicates release by the absence of buttons being // held, which is InputMouseState::None. This makes it more reliable in my opinion. - } else if (WHEEL..WHEEL + 4).contains(&kind) { - let delta = if (kind & 1) != 0 { 3 } else { -3 }; - let idx = if (kind & 2) != 0 { 0 } else { 1 }; - mouse.scroll.as_array()[idx] += delta; + } else if (WHEEL..WHEEL + 0x08).contains(&kind) { + let scroll_mult = if (btn & ALT) != 0 { 5 } else { 1 }; + if (btn & 0x06) != 0 { + mouse.scroll.x += if (btn & 0x01) != 0 { 7 } else { -7 } * scroll_mult; + } else { + mouse.scroll.y += if (btn & 0x01) != 0 { 3 } else { -3 } * scroll_mult; + } mouse.state = InputMouseState::Scroll; } else if (kind & !MOTION) < 3 { match kind & 3 { From d28353aed3413793fc0b5ddfd3612b6067657ad7 Mon Sep 17 00:00:00 2001 From: Garnet DeGelder Date: Wed, 29 Apr 2026 21:47:43 -0400 Subject: [PATCH 2/2] Move some scrolling logic to tui.rs --- crates/edit/src/input.rs | 11 ++++------- crates/edit/src/tui.rs | 8 +++++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/crates/edit/src/input.rs b/crates/edit/src/input.rs index 31752379628..02d205f13f0 100644 --- a/crates/edit/src/input.rs +++ b/crates/edit/src/input.rs @@ -569,13 +569,10 @@ impl<'input> Stream<'_, '_, 'input> { // I know there's an InputMouseState::Release, but that's because the internals of tui.rs // have leaked into intput.rs. input.rs indicates release by the absence of buttons being // held, which is InputMouseState::None. This makes it more reliable in my opinion. - } else if (WHEEL..WHEEL + 0x08).contains(&kind) { - let scroll_mult = if (btn & ALT) != 0 { 5 } else { 1 }; - if (btn & 0x06) != 0 { - mouse.scroll.x += if (btn & 0x01) != 0 { 7 } else { -7 } * scroll_mult; - } else { - mouse.scroll.y += if (btn & 0x01) != 0 { 3 } else { -3 } * scroll_mult; - } + } else if (WHEEL..WHEEL + 0x04).contains(&kind) { + let delta = if (btn & 0x01) != 0 { 1 } else { -1 }; + let idx = if (btn & (0x02 | SHIFT)) != 0 { 0 } else { 1 }; + mouse.scroll.as_array()[idx] += delta; mouse.state = InputMouseState::Scroll; } else if (kind & !MOTION) < 3 { match kind & 3 { diff --git a/crates/edit/src/tui.rs b/crates/edit/src/tui.rs index 0fb7e628bc2..7d30c19f95b 100644 --- a/crates/edit/src/tui.rs +++ b/crates/edit/src/tui.rs @@ -575,7 +575,7 @@ impl Tui { Some(Input::Mouse(mouse)) => { let mut next_state = mouse.state; let next_position = mouse.position; - let next_scroll = mouse.scroll; + let mut next_scroll = mouse.scroll; let mouse_down = self.mouse_state == InputMouseState::None && next_state != InputMouseState::None; let mouse_up = self.mouse_state != InputMouseState::None @@ -621,6 +621,12 @@ impl Tui { if is_scroll { next_state = self.mouse_state; + next_scroll.x *= 7; + next_scroll.y *= 3; + if mouse.modifiers.contains(kbmod::ALT) { + next_scroll.x *= 5; + next_scroll.y *= 5; + } } else if is_drag { self.mouse_is_drag = true; } else if mouse_down {