diff options
author | gavynriebau | 2022-06-05 02:27:41 +0000 |
---|---|---|
committer | GitHub | 2022-06-05 02:27:41 +0000 |
commit | 026241cf72df9a684ec889a146bead9266dba374 (patch) | |
tree | 865b7fc06e60b33de95df4c6ccce90ece069946e /helix-view/src/editor.rs | |
parent | 5b4e0a304bc85b55202c895622b5cccf930a171f (diff) |
Fix panic on close last buffer (#2367) (#2658)
* Fix panic on close last buffer (#2367)
In certain circumstances it was possible to cause a panic when closing
buffers due to some mishandling of view document history.
A change has been made to delete removed documents from the history of
accessed documents for each view. The ensures we don't attempt to jump
to a deleted document by mistake.
* Move remove document code into View function 'remove_document'
* Replace 'view.jumps.remove' call with 'view.remove_document' call
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r-- | helix-view/src/editor.rs | 5 |
1 files changed, 2 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 |