Skip to content

Commit d9021f9

Browse files
shnarazkthomasskk
authored andcommitted
Set the selection point of the first file correctly (helix-editor#3073)
1 parent 79f3aa4 commit d9021f9

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

helix-term/src/application.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ impl Application {
151151
compositor.push(Box::new(overlayed(picker)));
152152
} else {
153153
let nr_of_files = args.files.len();
154-
editor.open(first, Action::VerticalSplit)?;
155-
// Because the line above already opens the first file, we can
156-
// simply skip opening it a second time by using .skip(1) here.
157-
for (file, pos) in args.files.into_iter().skip(1) {
154+
for (i, (file, pos)) in args.files.into_iter().enumerate() {
158155
if file.is_dir() {
159156
return Err(anyhow::anyhow!(
160157
"expected a path to file, found a directory. (to open a directory pass it as first argument)"
@@ -166,6 +163,7 @@ impl Application {
166163
// option. If neither of those two arguments are passed
167164
// in, just load the files normally.
168165
let action = match args.split {
166+
_ if i == 0 => Action::VerticalSplit,
169167
Some(Layout::Vertical) => Action::VerticalSplit,
170168
Some(Layout::Horizontal) => Action::HorizontalSplit,
171169
None => Action::Load,

0 commit comments

Comments
 (0)