Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore start position functionality for the first file #2983

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions helix-term/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,13 @@ 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
let doc_id = editor.open(first, Action::VerticalSplit)?;
let view_id = editor.tree.focus;
let doc = editor.document_mut(doc_id).unwrap();
let pos =
Selection::point(pos_at_coords(doc.text().slice(..), args.files[0].1, true));
doc.set_selection(view_id, pos);
// Because the lines above already open 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) {
if file.is_dir() {
Expand Down