From 9a9e462183cb60bff6450f17173e6b18eadbbfb2 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sun, 27 Nov 2022 12:47:26 -0600 Subject: Call View::apply within Document::append_changes_to_history --- helix-view/src/document.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'helix-view') diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 17503553..ad47f838 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -641,7 +641,7 @@ impl Document { // of the encoding. let transaction = helix_core::diff::compare_ropes(self.text(), &rope); apply_transaction(&transaction, self, view); - self.append_changes_to_history(view.id); + self.append_changes_to_history(view); self.reset_modified(); self.detect_indent_and_line_ending(); @@ -928,7 +928,7 @@ impl Document { } /// Commit pending changes to history - pub fn append_changes_to_history(&mut self, view_id: ViewId) { + pub fn append_changes_to_history(&mut self, view: &mut View) { if self.changes.is_empty() { return; } @@ -938,7 +938,7 @@ impl Document { // Instead of doing this messy merge we could always commit, and based on transaction // annotations either add a new layer or compose into the previous one. let transaction = - Transaction::from(changes).with_selection(self.selection(view_id).clone()); + Transaction::from(changes).with_selection(self.selection(view.id).clone()); // HAXX: we need to reconstruct the state as it was before the changes.. let old_state = self.old_state.take().expect("no old_state available"); @@ -946,6 +946,9 @@ impl Document { let mut history = self.history.take(); history.commit_revision(&transaction, &old_state); self.history.set(history); + + // Update jumplist entries in the view. + view.apply(&transaction, self); } pub fn id(&self) -> DocumentId { -- cgit v1.2.3-70-g09d2