diff options
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/editor.rs | 5 | ||||
-rw-r--r-- | helix-view/src/view.rs | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index c53fcc7f..f2fb4301 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -681,7 +681,7 @@ impl Editor { // Remove the scratch buffer from any jumplists for (view, _) in self.tree.views_mut() { - view.jumps.remove(&id) + view.remove_document(&id); } } else { let jump = (view.doc, doc.selection(view.id).clone()); @@ -814,8 +814,7 @@ impl Editor { .tree .views_mut() .filter_map(|(view, _focus)| { - // remove the document from jump list of all views - view.jumps.remove(&doc_id); + view.remove_document(&doc_id); if view.doc == doc_id { // something was previously open in the view, switch to previous doc diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs index 091d1f2e..a496fe33 100644 --- a/helix-view/src/view.rs +++ b/helix-view/src/view.rs @@ -316,6 +316,11 @@ impl View { )) } + pub fn remove_document(&mut self, doc_id: &DocumentId) { + self.jumps.remove(doc_id); + self.docs_access_history.retain(|doc| doc != doc_id); + } + // pub fn traverse<F>(&self, text: RopeSlice, start: usize, end: usize, fun: F) // where // F: Fn(usize, usize), |