patch 9.1.1162: completion popup not cleared in cmdline
Commit:
https://github.com/vim/vim/commit/ff159253eb55fa881e1fcfc45f1de5d73d15bdd4
Author: glepnir <[email protected]>
Date: Sat Mar 1 16:17:00 2025 +0100
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]>
diff --git a/src/popupwin.c b/src/popupwin.c
index c84c079d3..2032492a9 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -40,6 +40,8 @@ static int message_win_time = 3000;
// hit-enter prompt.
static int start_message_win_timer = FALSE;
+static int popup_on_cmdline = FALSE;
+
static void may_start_message_win_timer(win_T *wp);
#endif
@@ -4564,7 +4566,19 @@ popup_hide_info(void)
win_T *wp = popup_find_info_window();
if (wp != NULL)
+ {
+ popup_on_cmdline = wp->w_popup_flags & POPF_ON_CMDLINE;
popup_hide(wp);
+ }
+}
+
+/*
+ * Returns TRUE if a popup extends into the cmdline area.
+ */
+ int
+popup_overlaps_cmdline(void)
+{
+ return popup_on_cmdline;
}
/*
diff --git a/src/proto/popupwin.pro b/src/proto/popupwin.pro
index 11679c68e..14432fc94 100644
--- a/src/proto/popupwin.pro
+++ b/src/proto/popupwin.pro
@@ -74,4 +74,6 @@ void end_echowindow(void);
int popup_win_closed(win_T *win);
void popup_set_title(win_T *wp);
void popup_update_preview_title(void);
+int popup_overlaps_cmdline(void);
+
/* vim: set ft=c : */
diff --git a/src/screen.c b/src/screen.c
index b4476c267..b8a9c4805 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2327,7 +2327,11 @@ screen_fill(
{
redraw_cmdline = TRUE;
if (start_col == 0 && end_col == Columns
- && c1 == ' ' && c2 == ' ' && attr == 0)
+ && c1 == ' ' && c2 == ' ' && attr == 0
+#ifdef FEAT_PROP_POPUP
+ && !popup_overlaps_cmdline()
+#endif
+ )
clear_cmdline = FALSE; // command line has been cleared
if (start_col == 0)
mode_displayed = FALSE; // mode cleared or overwritten
diff --git
a/src/testdir/dumps/Test_info_popupwin_clears_cmdline_on_hide_01.dump
b/src/testdir/dumps/Test_info_popupwin_clears_cmdline_on_hide_01.dump
new file mode 100644
index 000000000..27947cd33
--- /dev/null
+++ b/src/testdir/dumps/Test_info_popupwin_clears_cmdline_on_hide_01.dump
@@ -0,0 +1,15 @@
+|f+0&#ffffff0|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|o+0#0000001#ffd7ff255|n|e| @11| +0#0000000#ffffff0@59
+|t+0#0000001#ffd7ff255|w|o| @11| +0#0000000#ffffff0@59
+|t+0#0000001#ffd7ff255|h|r|e@1| @9| +0#0000000#ffffff0@59
+|f+0#0000001#ffd7ff255|o|u|r| @10| +0#0000000#ffffff0@59
+|f+0#0000001#e0e0e08|i|v|e| @11|o|n|e| @2| +0#0000000#ffffff0@52
+|f|i|v|e> @10| +0#0000001#e0e0e08|t|w|o| @2| +0#0000000#ffffff0@52
+|-+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|
diff --git
a/src/testdir/dumps/Test_info_popupwin_clears_cmdline_on_hide_02.dump
b/src/testdir/dumps/Test_info_popupwin_clears_cmdline_on_hide_02.dump
new file mode 100644
index 000000000..146f495d1
--- /dev/null
+++ b/src/testdir/dumps/Test_info_popupwin_clears_cmdline_on_hide_02.dump
@@ -0,0 +1,15 @@
+|f+0&#ffffff0|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|o@1|b|a|r| @68
+|f|i|v>e| @70
+@57|1|6|,|4| @9|B|o|t|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 8b6b78ff9..e1041ef20 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -4404,6 +4404,31 @@ func Test_popupwin_clears_cmdline_on_hide()
" clean up
call StopVimInTerminal(buf)
+
+ let lines =<< trim END
+ set completeopt=menuone,noinsert,noselect,popup,fuzzy
+ set completepopup=border:off
+ let g:list = [
+ \ {"word": "one", "info": "one
two
three
four
five"},
+ \ {"word": "two", "info": "one
two
three
four
five"},
+ \ {"word": "three", "info": "one
two
three
four
five"},
+ \ {"word": "four", "info": "one
two
three
four
five"},
+ \ {"word": "five", "info": "one
two
three
four
five"}
+ \ ]
+ call setline(1, repeat(['foobar'], &lines))
+ inoremap <f5> <cmd>call complete(1, g:list)<cr>
+ END
+ call writefile(lines, 'XtestPopup_win3', 'D')
+ let buf = RunVimInTerminal('-S XtestPopup_win3', #{rows: 15})
+ call term_sendkeys(buf, "Go\<F5>\<C-N>\<C-N>\<C-N>\<C-N>\<C-N>")
+ call term_wait(buf, 100)
+ call VerifyScreenDump(buf, 'Test_info_popupwin_clears_cmdline_on_hide_01',
{})
+
+ call term_sendkeys(buf, "\<Esc>")
+ call term_wait(buf, 500)
+ call VerifyScreenDump(buf, 'Test_info_popupwin_clears_cmdline_on_hide_02',
{})
+
+ call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2
diff --git a/src/version.c b/src/version.c
index 398d72509..e95cf7e06 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 */
+/**/
+ 1162,
/**/
1161,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1toOn4-002c2E-Va%40256bit.org.