From 63089badf1464ef5433e7061a6eba371889dfd6d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 23 Nov 2021 19:14:39 +0100 Subject: [PATCH] Simulate line-wise selection when clicking on the gutter --- crates/editor/src/element.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 741519e5b0..0eef242bd7 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -70,6 +70,15 @@ impl EditorElement { click_count, })); true + } else if paint.gutter_bounds.contains_point(position) { + let snapshot = self.snapshot(cx.app); + let position = paint.point_for_position(&snapshot, layout, position); + cx.dispatch_action(Select(SelectPhase::Begin { + position, + add: cmd, + click_count: 3, + })); + true } else { false } @@ -829,6 +838,7 @@ impl Element for EditorElement { Some(PaintState { bounds, + gutter_bounds, text_bounds, }) } else { @@ -955,6 +965,7 @@ impl LayoutState { pub struct PaintState { bounds: RectF, + gutter_bounds: RectF, text_bounds: RectF, }