fix: pass alpha window to move_cursor() in CursorMoved callback #201
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
CursorMoved
autocmd should pass the explicit alpha window handle tomove_cursor()
(and on to the API calls). This doesn't directly address theFIXME
comment directly above the change, but this does fix an actual issue when usingalpha
andfzf-lua
.Due to this commit in neovim,
CursorMoved
autocmds are now fired when callingvim.api.nvim_win_set_cursor()
. There's likely an upstream neovim bug in the mix here, but it seems that if we just tell the API to use the "current window" in that callback (even if its a buffer-local callback for the alpha buffer only), neovim gets confused and jacks up the offsets for determining where to open float windows. Its as if neovim is firing the CursorMoved callback for the alpha buffer, but the window has already been switched to the new float, so it tried to move the cursor in the wrong window.Generally, probably better to be explicit about the specific windows and buffers in play for the autocommands since we have the handle numbers, anyway.
For reference, this is the PR and issue that I started this issue (and likely needs to be followed up with another fix):
neovim/neovim#21072
neovim/neovim#19063