From dfc31e74af1b96d9097496f1faa38710ecd30580 Mon Sep 17 00:00:00 2001 From: "Kyle L. Davis" Date: Sat, 23 Jul 2022 04:42:28 -0500 Subject: [PATCH] Fix different document panic (#3160) Would panic when given the view for the current document for a different document. --- helix-view/src/editor.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 6cd4515c0..7bfeb8dba 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -878,6 +878,7 @@ pub fn switch(&mut self, id: DocumentId, action: Action) { let view = self .tree .try_get(self.tree.focus) + .filter(|v| id == v.doc) // Different Document .cloned() .unwrap_or_else(|| View::new(id, self.config().gutters.clone())); let view_id = self.tree.split(