vim-patch:8.2.0007: popup menu positioned wrong with folding in two tabs

Problem:    Popup menu positioned wrong with folding in two tabs.
Solution:   Update the cursor line height. (closes vim/vim#5353)
09dd2bb336
This commit is contained in:
Jan Edmund Lazo 2020-10-08 18:52:18 -04:00
parent 56bb5993d9
commit 2bfe2018d6
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
3 changed files with 28 additions and 1 deletions

View File

@ -641,7 +641,7 @@ void validate_virtcol_win(win_T *wp)
/*
* Validate curwin->w_cline_height only.
*/
static void validate_cheight(void)
void validate_cheight(void)
{
check_cursor_moved(curwin);
if (!(curwin->w_valid & VALID_CHEIGHT)) {

View File

@ -226,6 +226,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
pum_above = false;
// Leave two lines of context if possible
validate_cheight();
if (curwin->w_cline_row + curwin->w_cline_height - curwin->w_wrow >= 3) {
context_lines = 3;
} else {

View File

@ -1,3 +1,5 @@
source screendump.vim
source check.vim
" Test for insert expansion
func Test_ins_complete()
@ -338,3 +340,27 @@ func Test_compl_in_cmdwin()
delcom GetInput
set wildmenu& wildchar&
endfunc
func Test_pum_with_folds_two_tabs()
CheckScreendump
let lines =<< trim END
set fdm=marker
call setline(1, ['" x {{{1', '" a some text'])
call setline(3, range(&lines)->map({_, val -> '" a' .. val}))
norm! zm
tab sp
call feedkeys('2Gzv', 'xt')
call feedkeys("0fa", 'xt')
END
call writefile(lines, 'Xpumscript')
let buf = RunVimInTerminal('-S Xpumscript', #{rows: 10})
call term_wait(buf, 100)
call term_sendkeys(buf, "a\<C-N>")
call VerifyScreenDump(buf, 'Test_pum_with_folds_two_tabs', {})
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
call delete('Xpumscript')
endfunc