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

keep jump/file history when using :split #3031

Merged
merged 2 commits into from
Jul 22, 2022
Merged
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3992,12 +3992,23 @@ fn split(cx: &mut Context, action: Action) {
let id = doc.id();
let selection = doc.selection(view.id).clone();
let offset = view.offset;
let jumps = view.jumps.clone();
let docs_access_history = view.docs_access_history.clone();
let last_modified_docs = view.last_modified_docs;
let object_selections = view.object_selections.clone();
let gutters = view.gutters.clone();

cx.editor.switch(id, action);

// match the selection in the previous view
let (view, doc) = current!(cx.editor);
view.offset = offset;
view.jumps = jumps;
view.docs_access_history = docs_access_history;
view.last_modified_docs = last_modified_docs;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to change these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternate file uses this, "space a"

view.object_selections = object_selections;
view.gutters = gutters;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about doing this inside switch, under the split case? You should be able to just view.clone() the current view

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought that as well, but the offset was already here, so i just included it haha

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be fixed!


doc.set_selection(view.id, selection);
}

Expand Down