aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index b04a07dd..38182126 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -62,7 +62,15 @@ impl Editor {
}
let view = View::new(doc)?;
- self.tree.insert(view);
+ let existing_view_option = self
+ .tree
+ .views()
+ .find(|v| view.doc.path().unwrap().to_str() == v.0.doc.path().unwrap().to_str());
+ if let Some(existing_view) = existing_view_option {
+ self.tree.focus = existing_view.0.id;
+ } else {
+ self.tree.insert(view);
+ }
Ok(())
}