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

Jumping from the Quickfix List highlights the wrong position. #14

Open
Remich opened this issue Jul 3, 2020 · 2 comments
Open

Jumping from the Quickfix List highlights the wrong position. #14

Remich opened this issue Jul 3, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Remich
Copy link

Remich commented Jul 3, 2020

When the cursor is in the Quickfix List and then pressing enter on a entry in the Quickfix List often the wrong location is highlighted.
Often it is the position of the previous jump from the Quickfix List to a location in a document, which is highlighted.

How to reproduce:

Have several locations in your Quickfix List.
Quickfix LIst -> Enter -> New Location (1) -> Back to Quickfix List -> j -> Enter -> New Location (2);
Now Location 1 is highlighted, but Location 2 should actually be highlighted.

Edit: Numbers. I did not intend to mention other issues.

@DanilaMihailov DanilaMihailov self-assigned this Jul 3, 2020
@DanilaMihailov
Copy link
Owner

Yeah, I see that. Seems to be not working right when location from different file. Will look into it.

Thank you for feedback :)

@DanilaMihailov DanilaMihailov added the bug Something isn't working label Jul 3, 2020
@TheBlob42
Copy link

I just discovered this great plugin recently and I really like its functionality, but this issue here also annoys me quite a bit 🙈

I think the issue here is in the order of how the code is evaluated:

  • press enter in qf window
  • cursor jumps to the new window
  • WinEnter event is executed --> current line is highlighted
  • cursor is actually moved inside the window to the target destination

I checked the current line (see here) when the function is executed and it is always the last cursor position in that window before the jump. My Vimscript knowledge is quite limited and I have no idea how to defer the highlight call to execute it after the jump was completed.

For Neovim I found a hacky solution that works for now (at least I haven't faced any issues yet):
(beacon.vim - line 295)

" replace this
silent autocmd WinEnter * call s:Highlight_position(v:false)
" with this
silent autocmd WinEnter * lua vim.schedule(function() vim.cmd('Beacon') end)

The vim.schedule function will defer the call on the event loop, so it is executed after the jump from the quickfix list is completed. Therefore the correct line is then extracted in beacon.nvim and the highlighting works. Unfortunately I have no idea how to transform this into a "general" solution working for Vim and Neovim ☹️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants