nvim-cmp
nvim-cmp copied to clipboard
Fix completion menu appearance when directly below virtual text lines
The current implementation of api.get_screen_cursor
does not work when completion is started right below a line of virtual text (when the entire line is virtual text). The returned window row is off by one, resulting in the completion menu hiding the current row. See the following:
The fix is to use vim.fn.winline
and vim.fn.wincol
directly.
This is after the fix:
screenpos()
has same problem?
And winline()
is broken when you have split same windows.
@Shougo screenpos()
was used originally. It is the source of the problem. Maybe its a bug with the internal implementation of nvim.
Anyway, I did not have any problems with splits. Can you give a specific example?
Anyway, I did not have any problems with splits. Can you give a specific example?
I have used winline()
in pum.vim
. But if split windows, it returns another window pos.
Please see the screenshot.
Note: screenpos()
returns right pos.
I see what you are talking about. However, I don't have any idea how to otherwise solve this. Maybe we should open an issue in nvim?
Opened an issue in nvim upstream: neovim/neovim#19543
Looks like the upstream issue is getting no traction, and I have no idea how to debug the problem myself. I changed the pull request to solve @Shougo 's problem, such that I am explicitly working around the screenpos bug.
This has been fixed upstream