diff options
-rw-r--r-- | helix-term/src/ui/editor.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 0b6ab046..4cac0fa8 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -1038,10 +1038,15 @@ impl EditorView { .. } = *event; - let pos_and_view = |editor: &Editor, row, column| { + let pos_and_view = |editor: &Editor, row, column, ignore_virtual_text| { editor.tree.views().find_map(|(view, _focus)| { - view.pos_at_screen_coords(&editor.documents[&view.doc], row, column, true) - .map(|pos| (pos, view.id)) + view.pos_at_screen_coords( + &editor.documents[&view.doc], + row, + column, + ignore_virtual_text, + ) + .map(|pos| (pos, view.id)) }) }; @@ -1056,7 +1061,7 @@ impl EditorView { MouseEventKind::Down(MouseButton::Left) => { let editor = &mut cxt.editor; - if let Some((pos, view_id)) = pos_and_view(editor, row, column) { + if let Some((pos, view_id)) = pos_and_view(editor, row, column, true) { let doc = doc_mut!(editor, &view!(editor, view_id).doc); if modifiers == KeyModifiers::ALT { @@ -1120,7 +1125,7 @@ impl EditorView { _ => unreachable!(), }; - match pos_and_view(cxt.editor, row, column) { + match pos_and_view(cxt.editor, row, column, false) { Some((_, view_id)) => cxt.editor.tree.focus = view_id, None => return EventResult::Ignored(None), } @@ -1191,7 +1196,7 @@ impl EditorView { return EventResult::Consumed(None); } - if let Some((pos, view_id)) = pos_and_view(editor, row, column) { + if let Some((pos, view_id)) = pos_and_view(editor, row, column, true) { let doc = doc_mut!(editor, &view!(editor, view_id).doc); doc.set_selection(view_id, Selection::point(pos)); cxt.editor.focus(view_id); |