aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorNarazaki Shuji2022-07-18 01:14:36 +0000
committerGitHub2022-07-18 01:14:36 +0000
commit55b45ec4a4cb958b241a93cc7c3f4e499379890e (patch)
treec5b7002e693f36180f45b40c200cc1d1cfbc2a37 /helix-term
parente8214fb1e6009d44a4b7094c6e5297a19f18f549 (diff)
Set the selection point of the first file correctly (#3073)
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index f4f0876c..3ee5481f 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -151,10 +151,7 @@ impl Application {
compositor.push(Box::new(overlayed(picker)));
} else {
let nr_of_files = args.files.len();
- editor.open(first, Action::VerticalSplit)?;
- // Because the line above already opens the first file, we can
- // simply skip opening it a second time by using .skip(1) here.
- for (file, pos) in args.files.into_iter().skip(1) {
+ for (i, (file, pos)) in args.files.into_iter().enumerate() {
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)"
@@ -166,6 +163,7 @@ impl Application {
// option. If neither of those two arguments are passed
// in, just load the files normally.
let action = match args.split {
+ _ if i == 0 => Action::VerticalSplit,
Some(Layout::Vertical) => Action::VerticalSplit,
Some(Layout::Horizontal) => Action::HorizontalSplit,
None => Action::Load,