aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-05-07 05:30:23 +0000
committerBlaž Hrastnik2021-05-07 05:30:23 +0000
commit418ee17b86c24f03699659f4aa91b331a68e5666 (patch)
tree6a79617f04be5d71b5af44d442d87e49f94ec528
parent7c915dc0651f2cd69bc40adca027729c3b12f4e3 (diff)
Canonicalize the path on open to avoid duplicates.
-rw-r--r--helix-view/src/editor.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index e9f027f3..84d499e3 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -119,6 +119,8 @@ impl Editor {
}
pub fn open(&mut self, path: PathBuf, action: Action) -> Result<DocumentId, Error> {
+ let path = std::fs::canonicalize(path)?;
+
let id = self
.documents()
.find(|doc| doc.path() == Some(&path))