Skip to content

Commit ff15925

Browse files
glepnirchrisbra
authored andcommitted
patch 9.1.1162: completion popup not cleared in cmdline
Problem: When an info popup spans into the cmdline area and ESC is pressed, some content remains visible on screen (yu3s) Solution: Add popup_overlays_cmdline() check in screen_fill() to prevent prematurely clearing the clear_cmdline flag (glepnir). fixes: #15627 closes: #16765 Signed-off-by: glepnir <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 94a045e commit ff15925

7 files changed

Lines changed: 78 additions & 1 deletion

src/popupwin.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ static int message_win_time = 3000;
4040
// hit-enter prompt.
4141
static int start_message_win_timer = FALSE;
4242

43+
static int popup_on_cmdline = FALSE;
44+
4345
static void may_start_message_win_timer(win_T *wp);
4446
#endif
4547

@@ -4564,7 +4566,19 @@ popup_hide_info(void)
45644566
win_T *wp = popup_find_info_window();
45654567

45664568
if (wp != NULL)
4569+
{
4570+
popup_on_cmdline = wp->w_popup_flags & POPF_ON_CMDLINE;
45674571
popup_hide(wp);
4572+
}
4573+
}
4574+
4575+
/*
4576+
* Returns TRUE if a popup extends into the cmdline area.
4577+
*/
4578+
int
4579+
popup_overlaps_cmdline(void)
4580+
{
4581+
return popup_on_cmdline;
45684582
}
45694583

45704584
/*

src/proto/popupwin.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,6 @@ void end_echowindow(void);
7474
int popup_win_closed(win_T *win);
7575
void popup_set_title(win_T *wp);
7676
void popup_update_preview_title(void);
77+
int popup_overlaps_cmdline(void);
78+
7779
/* vim: set ft=c : */

src/screen.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2327,7 +2327,11 @@ screen_fill(
23272327
{
23282328
redraw_cmdline = TRUE;
23292329
if (start_col == 0 && end_col == Columns
2330-
&& c1 == ' ' && c2 == ' ' && attr == 0)
2330+
&& c1 == ' ' && c2 == ' ' && attr == 0
2331+
#ifdef FEAT_PROP_POPUP
2332+
&& !popup_overlaps_cmdline()
2333+
#endif
2334+
)
23312335
clear_cmdline = FALSE; // command line has been cleared
23322336
if (start_col == 0)
23332337
mode_displayed = FALSE; // mode cleared or overwritten
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
|f+0&#ffffff0|o@1|b|a|r| @68
2+
|f|o@1|b|a|r| @68
3+
|f|o@1|b|a|r| @68
4+
|f|o@1|b|a|r| @68
5+
|f|o@1|b|a|r| @68
6+
|f|o@1|b|a|r| @68
7+
|f|o@1|b|a|r| @68
8+
|f|o@1|b|a|r| @68
9+
|o+0#0000001#ffd7ff255|n|e| @11| +0#0000000#ffffff0@59
10+
|t+0#0000001#ffd7ff255|w|o| @11| +0#0000000#ffffff0@59
11+
|t+0#0000001#ffd7ff255|h|r|e@1| @9| +0#0000000#ffffff0@59
12+
|f+0#0000001#ffd7ff255|o|u|r| @10| +0#0000000#ffffff0@59
13+
|f+0#0000001#e0e0e08|i|v|e| @11|o|n|e| @2| +0#0000000#ffffff0@52
14+
|f|i|v|e> @10| +0#0000001#e0e0e08|t|w|o| @2| +0#0000000#ffffff0@52
15+
|-+2&&@1| |I|N|S|E|R|T| |-@1| +0&&@2| +0#0000001#e0e0e08|t|h|r|e@1| | +0#0000000#ffffff0@34|1|6|,|1| @9|B|o|t|
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
|f+0&#ffffff0|o@1|b|a|r| @68
2+
|f|o@1|b|a|r| @68
3+
|f|o@1|b|a|r| @68
4+
|f|o@1|b|a|r| @68
5+
|f|o@1|b|a|r| @68
6+
|f|o@1|b|a|r| @68
7+
|f|o@1|b|a|r| @68
8+
|f|o@1|b|a|r| @68
9+
|f|o@1|b|a|r| @68
10+
|f|o@1|b|a|r| @68
11+
|f|o@1|b|a|r| @68
12+
|f|o@1|b|a|r| @68
13+
|f|o@1|b|a|r| @68
14+
|f|i|v>e| @70
15+
@57|1|6|,|4| @9|B|o|t|

src/testdir/test_popupwin.vim

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4404,6 +4404,31 @@ func Test_popupwin_clears_cmdline_on_hide()
44044404

44054405
" clean up
44064406
call StopVimInTerminal(buf)
4407+
4408+
let lines =<< trim END
4409+
set completeopt=menuone,noinsert,noselect,popup,fuzzy
4410+
set completepopup=border:off
4411+
let g:list = [
4412+
\ {"word": "one", "info": "one\ntwo\nthree\nfour\nfive"},
4413+
\ {"word": "two", "info": "one\ntwo\nthree\nfour\nfive"},
4414+
\ {"word": "three", "info": "one\ntwo\nthree\nfour\nfive"},
4415+
\ {"word": "four", "info": "one\ntwo\nthree\nfour\nfive"},
4416+
\ {"word": "five", "info": "one\ntwo\nthree\nfour\nfive"}
4417+
\ ]
4418+
call setline(1, repeat(['foobar'], &lines))
4419+
inoremap <f5> <cmd>call complete(1, g:list)<cr>
4420+
END
4421+
call writefile(lines, 'XtestPopup_win3', 'D')
4422+
let buf = RunVimInTerminal('-S XtestPopup_win3', #{rows: 15})
4423+
call term_sendkeys(buf, "Go\<F5>\<C-N>\<C-N>\<C-N>\<C-N>\<C-N>")
4424+
call term_wait(buf, 100)
4425+
call VerifyScreenDump(buf, 'Test_info_popupwin_clears_cmdline_on_hide_01', {})
4426+
4427+
call term_sendkeys(buf, "\<Esc>")
4428+
call term_wait(buf, 500)
4429+
call VerifyScreenDump(buf, 'Test_info_popupwin_clears_cmdline_on_hide_02', {})
4430+
4431+
call StopVimInTerminal(buf)
44074432
endfunc
44084433

44094434
" vim: shiftwidth=2 sts=2

src/version.c

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

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1162,
707709
/**/
708710
1161,
709711
/**/

0 commit comments

Comments
 (0)