Simulate line-wise selection when clicking on the gutter

This commit is contained in:
Antonio Scandurra 2021-11-23 19:14:39 +01:00
parent 7a79df7a24
commit 63089badf1

View file

@ -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,
}