aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-16 14:05:43 +0000
committerBlaž Hrastnik2021-03-16 14:05:43 +0000
commite3ec5e31ec005e33da4c848b4272e81a6d21a5f0 (patch)
treea26c6025d45658b4d85d6917ea82489d6ba8fb2e /helix-view
parenteadad13efabb6a838a366b27002e09e1d2580750 (diff)
Fix goto code before merging.
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 99c0398f..5c94df27 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -33,13 +33,13 @@ impl Editor {
}
pub fn open(&mut self, path: PathBuf, executor: &smol::Executor) -> Result<(), Error> {
- // TODO: try to find an open view/buffer first
- let existing_view_option = self
+ let existing_view = self
.tree
.views()
- .find(|v| path.to_str().unwrap() == v.0.doc.path().unwrap().to_str().unwrap());
- if let Some(existing_view) = existing_view_option {
- self.tree.focus = existing_view.0.id;
+ .find(|(view, _)| view.doc.path() == Some(&path));
+
+ if let Some((view, _)) = existing_view {
+ self.tree.focus = view.id;
return Ok(());
}