From 8529d756fad2eeea543b487e1ff5253857bc2e16 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 25 Nov 2022 20:52:22 -0600 Subject: [PATCH] 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. --- helix-view/src/editor.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 23e0a4976..6eaa89aac 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(); }