Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r--helix-term/src/application.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index a567815f..36cb295c 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -175,7 +175,7 @@ impl Application {
nr_of_files += 1;
if file.is_dir() {
return Err(anyhow::anyhow!(
- "expected a path to file, found a directory. (to open a directory pass it as first argument)"
+ "expected a path to file, but found a directory: {file:?}. (to open a directory pass it as first argument)"
));
} else {
// If the user passes in either `--vsplit` or
@@ -189,6 +189,7 @@ impl Application {
Some(Layout::Horizontal) => Action::HorizontalSplit,
None => Action::Load,
};
+ let old_id = editor.document_id_by_path(&file);
let doc_id = match editor.open(&file, action) {
// Ignore irregular files during application init.
Err(DocumentOpenError::IrregularFile) => {
@@ -196,6 +197,11 @@ impl Application {
continue;
}
Err(err) => return Err(anyhow::anyhow!(err)),
+ // We can't open more than 1 buffer for 1 file, in this case we already have opened this file previously
+ Ok(doc_id) if old_id == Some(doc_id) => {
+ nr_of_files -= 1;
+ doc_id
+ }
Ok(doc_id) => doc_id,
};
// with Action::Load all documents have the same view