Fix different document panic (#3160)

Would panic when given the view for the current document for a different document.
This commit is contained in:
Kyle L. Davis 2022-07-23 04:42:28 -05:00 committed by GitHub
parent 1b3a10d906
commit dfc31e74af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(