From 698583c24124e9d01db7095259511bf6a8cf547e Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Sat, 4 Sep 2021 21:14:24 +0300 Subject: Support setting breakpoints with mouse --- helix-term/src/ui/editor.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'helix-term/src/ui') 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 } -- cgit v1.2.3-70-g09d2