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