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 crash on opening jumplist #6672

Merged
merged 5 commits into from
Apr 11, 2023

Conversation

EsfoNL
Copy link
Contributor

@EsfoNL EsfoNL commented Apr 9, 2023

Hopefully solves #6628.
Moved the code to a separate function as was recommended in the issue.

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

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

This change doesn't fully solve the issue: you can still cause a panic with the sequence [<space>:new<ret><C-w>v:buffer-next<ret>d<space>j. The current change syncs the view for each focused doc but the docs in the jumplist may not be focused. That sequence panics because the first scratch buffer isn't focused in the first view so it isn't synced.

We need to sync changes between each view and all of the docs in view.jumps()

@EsfoNL
Copy link
Contributor Author

EsfoNL commented Apr 10, 2023

Should be fixed, according to my testing

let doc = doc_mut!(self, &view.doc);
view.sync_changes(doc);
}
self.sync_views();
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to sync unfocused docs here so using a shared function does more work than we need. Let's eliminate the shared sync_views function and instead sync the views as we create the items for the file picker (currently this block)

Copy link
Contributor Author

@EsfoNL EsfoNL Apr 10, 2023

Choose a reason for hiding this comment

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

Because the new meta closure captures &cx.editor, it is impossible to also use &mut cx.editor to create the &mut Doc that is needed to sync the view with a doc so i have opted to sync the views earlier in the function. Thank you for your patience as i become more familiar with this repository by the way.

@the-mikedavis the-mikedavis linked an issue Apr 11, 2023 that may be closed by this pull request
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

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

Thanks!

@the-mikedavis the-mikedavis merged commit 2f82bc1 into helix-editor:master Apr 11, 2023
Triton171 pushed a commit to Triton171/helix that referenced this pull request Jun 18, 2023
wes-adams pushed a commit to wes-adams/helix that referenced this pull request Jul 4, 2023
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic when opening jump list
2 participants