do not ignore mouse scrolling when on top of virtual text

pull/6188/merge
Pascal Kuthe 2 years ago committed by Blaž Hrastnik
parent 15e751b9a2
commit 9fac574178

@ -1038,9 +1038,14 @@ 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)
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);

Loading…
Cancel
Save