aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2022-11-26 02:52:22 +0000
committerGitHub2022-11-26 02:52:22 +0000
commit8529d756fad2eeea543b487e1ff5253857bc2e16 (patch)
tree02122d910b604686dcb5bcaacd5324d69b52e82b
parent4e52d4d6f456e082f29f585c7a03a3ef1cbf156e (diff)
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.
-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();
}