on master help sign in
Set the selection point of the first file correctly (#3073)
commit55b45ec4a4cb958b241a93cc7c3f4e499379890e authorNarazaki Shuji <shujinarazaki@protonmail.com> dateMon 18 Jul 2022, 10:14 (4 years ago) parente8214fb
1 file changed+2−4
helix-term/src/application.rs+2−4
helix-term/src/application.rs+2−4
@@ -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,