aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorPascal Kuthe2024-01-09 00:56:09 +0000
committerGitHub2024-01-09 00:56:09 +0000
commit48c49f02278712f20235f3ba3912fba9e55b8ebb (patch)
tree6a4d0e015f20f5e4ee9263c5621d3abc44d8de2d /helix-term
parent0cbd8d3df1ec6faa088f4439e52865f8daf78dc3 (diff)
update history of a newly focused view (#9271)
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/editor.rs22
1 files changed, 8 insertions, 14 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index c808be17..ff267e42 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -1302,8 +1302,6 @@ impl Component for EditorView {
cx.editor.status_msg = None;
let mode = cx.editor.mode();
- let (view, _) = current!(cx.editor);
- let focus = view.id;
if let Some(on_next_key) = self.on_next_key.take() {
// if there's a command waiting input, do that first
@@ -1385,20 +1383,16 @@ impl Component for EditorView {
return EventResult::Ignored(None);
}
- // if the focused view still exists and wasn't closed
- if cx.editor.tree.contains(focus) {
- let config = cx.editor.config();
- let mode = cx.editor.mode();
- let view = view_mut!(cx.editor, focus);
- let doc = doc_mut!(cx.editor, &view.doc);
+ let config = cx.editor.config();
+ let mode = cx.editor.mode();
+ let (view, doc) = current!(cx.editor);
- view.ensure_cursor_in_view(doc, config.scrolloff);
+ view.ensure_cursor_in_view(doc, config.scrolloff);
- // Store a history state if not in insert mode. This also takes care of
- // committing changes when leaving insert mode.
- if mode != Mode::Insert {
- doc.append_changes_to_history(view);
- }
+ // Store a history state if not in insert mode. This also takes care of
+ // committing changes when leaving insert mode.
+ if mode != Mode::Insert {
+ doc.append_changes_to_history(view);
}
EventResult::Consumed(callback)