diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index c935df7d07..1881d14842 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1582,6 +1582,7 @@ impl Element for EditorElement { position, delta, precise, + .. }) => self.scroll(*position, *delta, *precise, layout, paint, cx), &Event::ModifiersChanged(event) => self.modifiers_changed(event, cx), diff --git a/crates/gpui/src/elements/flex.rs b/crates/gpui/src/elements/flex.rs index 1d577344c6..798fb3e8c0 100644 --- a/crates/gpui/src/elements/flex.rs +++ b/crates/gpui/src/elements/flex.rs @@ -293,6 +293,7 @@ impl Element for Flex { position, delta, precise, + .. }) = event { if *remaining_space < 0. && bounds.contains_point(position) { diff --git a/crates/gpui/src/elements/list.rs b/crates/gpui/src/elements/list.rs index e0ca47b598..d3c15c4e2b 100644 --- a/crates/gpui/src/elements/list.rs +++ b/crates/gpui/src/elements/list.rs @@ -316,6 +316,7 @@ impl Element for List { position, delta, precise, + .. }) = event { if bounds.contains_point(*position) diff --git a/crates/gpui/src/elements/uniform_list.rs b/crates/gpui/src/elements/uniform_list.rs index bf9a0a4e30..103cb00d8c 100644 --- a/crates/gpui/src/elements/uniform_list.rs +++ b/crates/gpui/src/elements/uniform_list.rs @@ -315,6 +315,7 @@ impl Element for UniformList { position, delta, precise, + .. }) = event { if bounds.contains_point(*position) diff --git a/crates/gpui/src/platform/event.rs b/crates/gpui/src/platform/event.rs index 6ac75926be..010fc9a733 100644 --- a/crates/gpui/src/platform/event.rs +++ b/crates/gpui/src/platform/event.rs @@ -24,6 +24,10 @@ pub struct ScrollWheelEvent { pub position: Vector2F, pub delta: Vector2F, pub precise: bool, + pub ctrl: bool, + pub alt: bool, + pub shift: bool, + pub cmd: bool, } #[derive(Hash, PartialEq, Eq, Copy, Clone, Debug)] diff --git a/crates/gpui/src/platform/mac/event.rs b/crates/gpui/src/platform/mac/event.rs index a53e009589..c6f838b431 100644 --- a/crates/gpui/src/platform/mac/event.rs +++ b/crates/gpui/src/platform/mac/event.rs @@ -148,6 +148,8 @@ impl Event { }) } NSEventType::NSScrollWheel => window_height.map(|window_height| { + let modifiers = native_event.modifierFlags(); + Self::ScrollWheel(ScrollWheelEvent { position: vec2f( native_event.locationInWindow().x as f32, @@ -158,6 +160,10 @@ impl Event { native_event.scrollingDeltaY() as f32, ), precise: native_event.hasPreciseScrollingDeltas() == YES, + ctrl: modifiers.contains(NSEventModifierFlags::NSControlKeyMask), + alt: modifiers.contains(NSEventModifierFlags::NSAlternateKeyMask), + shift: modifiers.contains(NSEventModifierFlags::NSShiftKeyMask), + cmd: modifiers.contains(NSEventModifierFlags::NSCommandKeyMask), }) }), NSEventType::NSLeftMouseDragged diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index ff313478c5..ed77b00707 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -703,7 +703,7 @@ impl Terminal { ///Scroll the terminal pub fn scroll(&mut self, scroll: &ScrollWheelEvent, origin: Vector2F) { - if self.mouse_mode(false) { + if self.mouse_mode(scroll.shift) { //TODO: Currently this only sends the current scroll reports as they come in. Alacritty //Sends the *entire* scroll delta on *every* scroll event, only resetting it when //The scroll enters 'TouchPhase::Started'. Do I need to replicate this? @@ -720,6 +720,7 @@ impl Terminal { } else if self .last_mode .contains(TermMode::ALT_SCREEN | TermMode::ALTERNATE_SCROLL) + && !scroll.shift { //TODO: See above TODO, also applies here. let scroll_lines = ((scroll.delta.y() * ALACRITTY_SCROLL_MULTIPLIER)