diff --git a/src/popupmenu.c b/src/popupmenu.c index d9ab997bf4..44235efbd7 100644 --- a/src/popupmenu.c +++ b/src/popupmenu.c @@ -1097,7 +1097,7 @@ pum_set_selected(int n, int repeat UNUSED) if (pum_selected != prev_selected) { # ifdef FEAT_PROP_POPUP - curwin->w_firstline = 1; + curwin->w_firstline = 0; # endif curwin->w_topline = 1; } diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index c34f6426e0..b302a3ee74 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -497,6 +497,52 @@ func Test_completefunc_info() set completefunc& endfunc +func ScrollInfoWindowUserDefinedFn(findstart, query) + " User defined function (i_CTRL-X_CTRL-U) + if a:findstart + return col('.') + endif + let infostr = range(20)->mapnew({_, v -> string(v)})->join("\n") + return [{'word': 'foo', 'info': infostr}, {'word': 'bar'}] +endfunc + +func ScrollInfoWindowPageDown() + call win_execute(popup_findinfo(), "normal! \") + return '' +endfunc + +func ScrollInfoWindowPageUp() + call win_execute(popup_findinfo(), "normal! \") + return '' +endfunc + +func ScrollInfoWindowTest(mvmt, count, fline) + new + set completeopt=menuone,popup,noinsert,noselect + set completepopup=height:5 + set completefunc=ScrollInfoWindowUserDefinedFn + let keyseq = "i\\\" + for _ in range(a:count) + let keyseq .= (a:mvmt == "pageup" ? "\\=ScrollInfoWindowPageUp()\" : + \ "\\=ScrollInfoWindowPageDown()\") + endfor + let keyseq .= "\\=string(popup_getpos(popup_findinfo()))\\" + call feedkeys(keyseq, "tx") + call assert_match('''firstline'': ' . a:fline, getline(1)) + bwipe! + set completeopt& + set completepopup& + set completefunc& +endfunc + +func Test_scroll_info_window() + call ScrollInfoWindowTest("", 0, 1) + call ScrollInfoWindowTest("pagedown", 1, 4) + call ScrollInfoWindowTest("pagedown", 2, 7) + call ScrollInfoWindowTest("pagedown", 3, 11) + call ScrollInfoWindowTest("pageup", 3, 1) +endfunc + func CompleteInfoUserDefinedFn(findstart, query) " User defined function (i_CTRL-X_CTRL-U) if a:findstart diff --git a/src/version.c b/src/version.c index 1d362718be..d028159f67 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1147, /**/ 1146, /**/