Skip to content

With 'nosplitscroll' the current window is unexpectedly scrolled when 'syntax' is set in a popup window #11145

@bfrg

Description

@bfrg

Steps to reproduce

  1. Runvim --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>
  1. While the cursor is located on the last line and centered on the screen, press g<cr>.
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions