|
|
@ -1038,10 +1038,15 @@ impl EditorView {
|
|
|
|
..
|
|
|
|
..
|
|
|
|
} = *event;
|
|
|
|
} = *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)| {
|
|
|
|
editor.tree.views().find_map(|(view, _focus)| {
|
|
|
|
view.pos_at_screen_coords(&editor.documents[&view.doc], row, column, true)
|
|
|
|
view.pos_at_screen_coords(
|
|
|
|
.map(|pos| (pos, view.id))
|
|
|
|
&editor.documents[&view.doc],
|
|
|
|
|
|
|
|
row,
|
|
|
|
|
|
|
|
column,
|
|
|
|
|
|
|
|
ignore_virtual_text,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.map(|pos| (pos, view.id))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -1056,7 +1061,7 @@ impl EditorView {
|
|
|
|
MouseEventKind::Down(MouseButton::Left) => {
|
|
|
|
MouseEventKind::Down(MouseButton::Left) => {
|
|
|
|
let editor = &mut cxt.editor;
|
|
|
|
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);
|
|
|
|
let doc = doc_mut!(editor, &view!(editor, view_id).doc);
|
|
|
|
|
|
|
|
|
|
|
|
if modifiers == KeyModifiers::ALT {
|
|
|
|
if modifiers == KeyModifiers::ALT {
|
|
|
@ -1120,7 +1125,7 @@ impl EditorView {
|
|
|
|
_ => unreachable!(),
|
|
|
|
_ => 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,
|
|
|
|
Some((_, view_id)) => cxt.editor.tree.focus = view_id,
|
|
|
|
None => return EventResult::Ignored(None),
|
|
|
|
None => return EventResult::Ignored(None),
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1191,7 +1196,7 @@ impl EditorView {
|
|
|
|
return EventResult::Consumed(None);
|
|
|
|
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);
|
|
|
|
let doc = doc_mut!(editor, &view!(editor, view_id).doc);
|
|
|
|
doc.set_selection(view_id, Selection::point(pos));
|
|
|
|
doc.set_selection(view_id, Selection::point(pos));
|
|
|
|
cxt.editor.focus(view_id);
|
|
|
|
cxt.editor.focus(view_id);
|
|
|
|