summaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorjliaoh2022-12-23 02:30:33 +0000
committerGitHub2022-12-23 02:30:33 +0000
commitdf1830ef28a7cb49abe31a18e4bd1bcfc7eb802a (patch)
tree92955e76124f4967b62d9220179aeef4efe88859 /helix-term/src
parent1107296ca9bfd728258a4571be35eb7c811ff3b3 (diff)
mouse operations respect scrolloff (#5255)
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/editor.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index fc201853..35cf77ab 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -1155,6 +1155,7 @@ impl EditorView {
}
editor.focus(view_id);
+ editor.ensure_cursor_in_view(view_id);
return EventResult::Consumed(None);
}
@@ -1191,7 +1192,8 @@ impl EditorView {
let primary = selection.primary_mut();
*primary = primary.put_cursor(doc.text().slice(..), pos, true);
doc.set_selection(view.id, selection);
-
+ let view_id = view.id;
+ cxt.editor.ensure_cursor_in_view(view_id);
EventResult::Consumed(None)
}
@@ -1213,6 +1215,7 @@ impl EditorView {
commands::scroll(cxt, offset, direction);
cxt.editor.tree.focus = current_view;
+ cxt.editor.ensure_cursor_in_view(current_view);
EventResult::Consumed(None)
}