Steps to reproduce
- Run
vim --clean -S test.vim, with
vim9script
set nosplitscroll
setline(1, range(100)->mapnew((_, i: number): string => i .. repeat(' test', 10)))
normal! G
normal! zz
normal! $
def Test()
const winid: number = popup_atcursor('// test test test', {})
setbufvar(winbufnr(winid), '&syntax', 'c')
enddef
nnoremap g<cr> <scriptcmd>Test()<cr>
- While the cursor is located on the last line and centered on the screen, press
g<cr>.
- Result: The window scrolls unexpectedly. In some situations the cursor jumps to the beginning of a line (which I haven't been able to reproduce with a minimal example yet).
The scrolling is definitively caused when setting the syntax for the buffer displayed in the popup window:
setbufvar(winbufnr(winid), '&syntax', 'c')
No issues arise when splitscroll is enabled.
Expected behaviour
No scrolling and no cursor jumps when the syntax is set for a buffer displayed in a popup window.
Version of Vim
9.0.478