diff options
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r-- | helix-view/src/editor.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index bd53c53b..ef0d8213 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -88,6 +88,12 @@ impl Editor { pub fn switch(&mut self, id: DocumentId, action: Action) { use crate::tree::Layout; use helix_core::Selection; + + if !self.documents.contains_key(id) { + log::error!("cannot switch to document that does not exist (anymore)"); + return; + } + match action { Action::Replace => { let view = self.view(); @@ -98,6 +104,7 @@ impl Editor { let view = self.view_mut(); view.jumps.push(jump); + view.last_accessed_doc = Some(view.doc); view.doc = id; view.first_line = 0; |