diff options
author | Pascal Kuthe | 2023-03-06 15:34:54 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2023-03-27 00:54:40 +0000 |
commit | 9fac574178bb6b66675ffc72819a79dee25112df (patch) | |
tree | cbead5d0238727ebec268f8edc873a8ea5670703 /helix-term | |
parent | 15e751b9a291b8732468235af95142bfbd0c9be2 (diff) |
do not ignore mouse scrolling when on top of virtual text
Diffstat (limited to 'helix-term')
-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); |