on master help sign in
Remove eager application of transactions to all views
commitdf5457a6e71b58a39e198642efd7be0c4963153d authorMichael Davis <mcarsondavis@gmail.com> dateSun 27 Nov 2022, 10:33 (4 years ago) parent04df9e4
1 file changed+3−23
helix-term/src/ui/editor.rs+3−23
helix-term/src/ui/editor.rs+3−23
@@ -1337,9 +1337,7 @@ impl Component for EditorView {
13371337 cx.editor.status_msg = None;
13381338
13391339 let mode = cx.editor.mode();
1340− let (view, doc) = current!(cx.editor);
1341− let original_doc_id = doc.id();
1342− let original_doc_revision = doc.get_current_revision();
1340+ let (view, _) = current!(cx.editor);
13431341 let focus = view.id;
13441342
13451343 if let Some(on_next_key) = self.on_next_key.take() {
@@ -1415,31 +1413,13 @@ impl Component for EditorView {
14151413 let view = view_mut!(cx.editor, focus);
14161414 let doc = doc_mut!(cx.editor, &view.doc);
14171415
1416+ view.ensure_cursor_in_view(doc, config.scrolloff);
1417+
14181418 // Store a history state if not in insert mode. This also takes care of
14191419 // committing changes when leaving insert mode.
14201420 if mode != Mode::Insert {
14211421 doc.append_changes_to_history(view.id);
14221422 }
1423−
1424− // If the current document has been changed, apply the changes to all views.
1425− // This ensures that selections in jumplists follow changes.
1426− if doc.id() == original_doc_id
1427− && doc.get_current_revision() != original_doc_revision
1428− {
1429− if let Some(transaction) =
1430− doc.history.get_mut().changes_since(original_doc_revision)
1431− {
1432− let doc = doc!(cx.editor, &original_doc_id);
1433− for (view, _focused) in cx.editor.tree.views_mut() {
1434− view.apply(&transaction, doc);
1435− }
1436− }
1437− }
1438−
1439− let view = view_mut!(cx.editor, focus);
1440− let doc = doc_mut!(cx.editor, &view.doc);
1441−
1442− view.ensure_cursor_in_view(doc, config.scrolloff);
14431423 }
14441424
14451425 EventResult::Consumed(callback)