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

<A-Enter> in the file picker jumps to a line in the current file instead of a new one #7673

Closed
woojiq opened this issue Jul 18, 2023 · 7 comments · Fixed by #7691
Closed
Labels
C-bug Category: This is a bug

Comments

@woojiq
Copy link
Contributor

woojiq commented Jul 18, 2023

Summary

Bug was introduced by #4435
Demo: https://asciinema.org/a/yQdXysBaY8nBwoBSoam92efq7
I press gr (goto reference) two times.
As you can see, when I first open with <Enter>, it immediately shows me a line with the selected goto reference. The second time I press Alt-Enter, it opens but the cursor of the new file is on 1 line and the line of my current file is scrambled.

Also, whoever is going to fix this, I would like to see these key bindings somewhere in the documentation, as the only mention of it is the code in PR.

Reproduction Steps

  1. hx helix-term/src/commands + g400g.
  2. gr + select second entry + <Alt-Enter>.

You will see that your cursor on the current file is on line 166. But it should actually open a new file on that line.

Helix log

~/.cache/helix/helix.log

Platform

Linux

Terminal Emulator

wezterm 20230712-072601-f4abf8fd

Helix Version

helix 23.05-230-g79a8fd62

@woojiq woojiq added the C-bug Category: This is a bug label Jul 18, 2023
@pascalkuthe
Copy link
Member

I don't understnd the issue here, what do you mean with opening a new file. <alt>ret doesn't open a split. It just does the same thing as enter without closing the picker. In my testing that is exactly what it does

@pascalkuthe pascalkuthe added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 20, 2023
@woojiq
Copy link
Contributor Author

woojiq commented Jul 20, 2023

@pascalkuthe have you tried <alt>ret with the default filepicker <space>f or a picker where the line number is appended to the filename (eg gr goto reference)?

@pascalkuthe
Copy link
Member

I tried with gr

@woojiq
Copy link
Contributor Author

woojiq commented Jul 20, 2023

example

  1. I open the main.rs file.
  2. gr for a function and see lib.rs:130 in the picker. Before I open it, my main file is on line 20 (for example).
  3. I press alt-enter to open lib.rs in a new buffer in the background.
  4. I close the picker and the main.rs buffer gets focus as expected, but now the current line is 130 (expected 20)
  5. I go to the next buffer (lib.rs) and it focused on line 1 (expected 130).

Do you understand my problem?

@pascalkuthe
Copy link
Member

pascalkuthe commented Jul 20, 2023

Hmm yeah thanks for clarifying I will try to reproduce again, I think I missunderstood your original description. I think I know what causes this. We are probably first loading the file and then changing the position in the current buffer. Implementing this might be a bit tricky since changing lines in an inactive buffer is usually not something we do

@pascalkuthe pascalkuthe removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 20, 2023
@woojiq
Copy link
Contributor Author

woojiq commented Jul 20, 2023

This patch fixes issue. Is it good enough for PR or should we come up with something better?

@pascalkuthe
Copy link
Member

That probably works, you can post a PR and we can take a closer look during review. I was thinking of something else regarding complexity its probably ok like that

pascalkuthe pushed a commit that referenced this issue Aug 8, 2023
* fix(picker): `alt-ret' changes cursor pos of current file, not new one

Closes #7673

* fix other pickers

* symbol pickers
* diagnostick pickers

This is done using the already patched `jump_to_location` method.

* fix global and jumplist pickers

* use `view` as old_id; make `align_view` method of `Action`

* test(picker): basic <alt-ret> functionality

* fix: picker integrational test

* fix nit

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
dgkf pushed a commit to dgkf/helix that referenced this issue Jan 30, 2024
…7691)

* fix(picker): `alt-ret' changes cursor pos of current file, not new one

Closes helix-editor#7673

* fix other pickers

* symbol pickers
* diagnostick pickers

This is done using the already patched `jump_to_location` method.

* fix global and jumplist pickers

* use `view` as old_id; make `align_view` method of `Action`

* test(picker): basic <alt-ret> functionality

* fix: picker integrational test

* fix nit

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
mtoohey31 pushed a commit to mtoohey31/helix that referenced this issue Jun 2, 2024
…7691)

* fix(picker): `alt-ret' changes cursor pos of current file, not new one

Closes helix-editor#7673

* fix other pickers

* symbol pickers
* diagnostick pickers

This is done using the already patched `jump_to_location` method.

* fix global and jumplist pickers

* use `view` as old_id; make `align_view` method of `Action`

* test(picker): basic <alt-ret> functionality

* fix: picker integrational test

* fix nit

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
smortime pushed a commit to smortime/helix that referenced this issue Jul 10, 2024
…7691)

* fix(picker): `alt-ret' changes cursor pos of current file, not new one

Closes helix-editor#7673

* fix other pickers

* symbol pickers
* diagnostick pickers

This is done using the already patched `jump_to_location` method.

* fix global and jumplist pickers

* use `view` as old_id; make `align_view` method of `Action`

* test(picker): basic <alt-ret> functionality

* fix: picker integrational test

* fix nit

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants