summaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/editor.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 47edf303..bb9616e8 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -1223,9 +1223,11 @@ impl Editor {
pub fn focus(&mut self, view_id: ViewId) {
let prev_id = std::mem::replace(&mut self.tree.focus, view_id);
- // if leaving the view: mode should reset
+ // if leaving the view: mode should reset and the cursor should be
+ // within view
if prev_id != view_id {
self.mode = Mode::Normal;
+ self.ensure_cursor_in_view(view_id);
}
}
@@ -1234,9 +1236,11 @@ impl Editor {
self.tree.focus_next();
let id = self.tree.focus;
- // if leaving the view: mode should reset
+ // if leaving the view: mode should reset and the cursor should be
+ // within view
if prev_id != id {
self.mode = Mode::Normal;
+ self.ensure_cursor_in_view(id);
}
}