Skip to content

Commit 614ab8a

Browse files
committed
patch 8.1.0554: popup menu overlaps with preview window
Problem: Popup menu overlaps with preview window. Solution: Adjust the height computation. (Hirohito Higashi, closes #3414)
1 parent 07dc18f commit 614ab8a

4 files changed

Lines changed: 48 additions & 13 deletions

File tree

src/popupmnu.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -196,20 +196,11 @@ pum_display(
196196
return;
197197

198198
#if defined(FEAT_QUICKFIX)
199-
// If there is a preview window at the above avoid drawing over it.
200-
// Do keep at least 10 entries.
201-
if (pvwin != NULL && pum_row < above_row && pum_height > 10)
199+
// If there is a preview window above avoid drawing over it.
200+
if (pvwin != NULL && pum_row < above_row && pum_height > above_row)
202201
{
203-
if (pum_win_row - above_row < 10)
204-
{
205-
pum_row = pum_win_row - 10;
206-
pum_height = 10;
207-
}
208-
else
209-
{
210-
pum_row = above_row;
211-
pum_height = pum_win_row - above_row;
212-
}
202+
pum_row = above_row;
203+
pum_height = pum_win_row - above_row;
213204
}
214205
#endif
215206

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
|a+0&#ffffff0|b|0| @71
2+
|a|b|1| @71
3+
|a|b|2| @71
4+
|a|b|3| @71
5+
|a|b|4| @71
6+
|a|b|5| @71
7+
|a|b|6| @71
8+
|a|b|7| @71
9+
|a|b|8| @71
10+
|a+0#0000001#e0e0e08|b|0| @11| +0#0000000#0000001|e+1&#ffffff0|w|]|[|+|]| @34|1|,|1| @11|T|o|p
11+
|a+0#0000001#ffd7ff255|b|1| @11| +0#0000000#0000001| +0&#ffffff0@58
12+
|a+0#0000001#ffd7ff255|b|2| @11| +0#0000000#0000001| +0&#ffffff0@58
13+
|a+0#0000001#ffd7ff255|b|3| @11| +0#0000000#0000001| +0&#ffffff0@58
14+
|a+0#0000001#ffd7ff255|b|4| @11| +0#0000000#a8a8a8255| +0&#ffffff0@58
15+
|a+0#0000001#ffd7ff255|b|5| @11| +0#0000000#a8a8a8255| +0&#ffffff0@58
16+
|a+0#0000001#ffd7ff255|b|6| @11| +0#0000000#a8a8a8255| +0&#ffffff0@58
17+
|a|b|0> @71
18+
|~+0#4040ff13&| @73
19+
|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @43|1|0|,|1| @10|B|o|t
20+
|-+2&&@1| |K|e|y|w|o|r|d| |L|o|c|a|l| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |1|0| +0#0000000&@26

src/testdir/test_popup.vim

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,28 @@ func Test_popup_and_preview_autocommand()
701701
bw!
702702
endfunc
703703

704+
func Test_popup_and_previewwindow_dump()
705+
if !CanRunVimInTerminal()
706+
return
707+
endif
708+
call writefile([
709+
\ 'set previewheight=9',
710+
\ 'silent! pedit',
711+
\ 'call setline(1, map(repeat(["ab"], 10), "v:val. v:key"))',
712+
\ 'exec "norm! G\<C-E>\<C-E>"',
713+
\ ], 'Xscript')
714+
let buf = RunVimInTerminal('-S Xscript', {})
715+
716+
" Test that popup and previewwindow do not overlap.
717+
call term_sendkeys(buf, "o\<C-X>\<C-N>")
718+
sleep 100m
719+
call VerifyScreenDump(buf, 'Test_popup_and_previewwindow_01', {})
720+
721+
call term_sendkeys(buf, "\<Esc>u")
722+
call StopVimInTerminal(buf)
723+
call delete('Xscript')
724+
endfunc
725+
704726
func Test_balloon_split()
705727
if !exists('*balloon_split')
706728
return

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,8 @@ static char *(features[]) =
792792

793793
static int included_patches[] =
794794
{ /* Add new patch number below this line */
795+
/**/
796+
554,
795797
/**/
796798
553,
797799
/**/

0 commit comments

Comments
 (0)