Unnamed repository; edit this file 'description' to name the repository.
Remove selections for closed views on all documents (#4888)
Previously we removed selections for a closed view on only the currently focused document. A view might have selections in other documents though, so the view needs to be removed from all documents.
Michael Davis 2022-11-26
parent 4e52d4d · commit 8529d75
-rw-r--r--helix-view/src/editor.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 23e0a497..6eaa89aa 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -1116,9 +1116,10 @@ impl Editor {
}
pub fn close(&mut self, id: ViewId) {
- let (_view, doc) = current!(self);
- // remove selection
- doc.remove_view(id);
+ // Remove selections for the closed view on all documents.
+ for doc in self.documents_mut() {
+ doc.remove_view(id);
+ }
self.tree.remove(id);
self._refresh();
}