update history of a newly focused view (#9271)

This commit is contained in:
Pascal Kuthe 2024-01-09 01:56:09 +01:00 committed by GitHub
parent 0cbd8d3df1
commit 48c49f0227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1302,8 +1302,6 @@ fn handle_event(
cx.editor.status_msg = None; cx.editor.status_msg = None;
let mode = cx.editor.mode(); 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 let Some(on_next_key) = self.on_next_key.take() {
// if there's a command waiting input, do that first // if there's a command waiting input, do that first
@ -1385,12 +1383,9 @@ fn handle_event(
return EventResult::Ignored(None); 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 config = cx.editor.config();
let mode = cx.editor.mode(); let mode = cx.editor.mode();
let view = view_mut!(cx.editor, focus); let (view, doc) = current!(cx.editor);
let doc = doc_mut!(cx.editor, &view.doc);
view.ensure_cursor_in_view(doc, config.scrolloff); view.ensure_cursor_in_view(doc, config.scrolloff);
@ -1399,7 +1394,6 @@ fn handle_event(
if mode != Mode::Insert { if mode != Mode::Insert {
doc.append_changes_to_history(view); doc.append_changes_to_history(view);
} }
}
EventResult::Consumed(callback) EventResult::Consumed(callback)
} }