Merge pull request #1545 from zed-industries/only-extend-selection-with-shift-without-other-modifiers

Only extend selection with shift without other modifiers
This commit is contained in:
Julia 2022-08-22 11:37:39 -04:00 committed by GitHub
commit 5019ae78c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,13 +110,17 @@ impl EditorElement {
self.update_view(cx, |view, cx| view.snapshot(cx)) self.update_view(cx, |view, cx| view.snapshot(cx))
} }
#[allow(clippy::too_many_arguments)]
fn mouse_down( fn mouse_down(
&self, &self,
position: Vector2F, MouseButtonEvent {
alt: bool, position,
shift: bool, ctrl,
mut click_count: usize, alt,
shift,
cmd,
mut click_count,
..
}: MouseButtonEvent,
layout: &mut LayoutState, layout: &mut LayoutState,
paint: &mut PaintState, paint: &mut PaintState,
cx: &mut EventContext, cx: &mut EventContext,
@ -135,7 +139,7 @@ impl EditorElement {
position, position,
goal_column: target_position.column(), goal_column: target_position.column(),
})); }));
} else if shift { } else if shift && !ctrl && !alt && !cmd {
cx.dispatch_action(Select(SelectPhase::Extend { cx.dispatch_action(Select(SelectPhase::Extend {
position, position,
click_count, click_count,
@ -1576,14 +1580,12 @@ impl Element for EditorElement {
} }
match event { match event {
&Event::MouseDown(MouseButtonEvent { &Event::MouseDown(
button: MouseButton::Left, event @ MouseButtonEvent {
position, button: MouseButton::Left,
alt, ..
shift, },
click_count, ) => self.mouse_down(event, layout, paint, cx),
..
}) => self.mouse_down(position, alt, shift, click_count, layout, paint, cx),
&Event::MouseDown(MouseButtonEvent { &Event::MouseDown(MouseButtonEvent {
button: MouseButton::Right, button: MouseButton::Right,