aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-09-04 18:14:24 +0000
committerDmitry Sharshakov2021-09-04 18:14:24 +0000
commit698583c24124e9d01db7095259511bf6a8cf547e (patch)
treebc1a1a687af706eea7cdb34b9244b868caf1c2e8 /helix-term/src
parentdf0ea6674ad1cbcbe8ceffded427d1d8c57951c8 (diff)
Support setting breakpoints with mouse
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/editor.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 818d275f..a41a7d64 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -980,6 +980,23 @@ impl EditorView {
return EventResult::Consumed(None);
}
+ let result = editor.tree.views().find_map(|(view, _focus)| {
+ view.gutter_coords_at_screen_coords(row, column)
+ .map(|coords| (coords.0, coords.1, view.id))
+ });
+
+ if let Some((line, _, view_id)) = result {
+ editor.tree.focus = view_id;
+
+ let doc = &mut editor.documents[editor.tree.get(view_id).doc];
+ if let Ok(pos) = doc.text().try_line_to_char(line) {
+ doc.set_selection(view_id, Selection::point(pos));
+ commands::dap_toggle_breakpoint(cxt);
+
+ return EventResult::Consumed(None);
+ }
+ }
+
EventResult::Ignored
}