]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0439: completion: info popup not removed in cmdline mode v9.2.0439
authorzeertzjq <zeertzjq@outlook.com>
Mon, 4 May 2026 19:53:10 +0000 (19:53 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 4 May 2026 19:53:10 +0000 (19:53 +0000)
Problem:  Info popup isn't removed when selecting an item that doesn't
          have "info" in cmdline completion, which is inconsistent with
          Insert mode behavior.
Solution: Set pum_call_update_screen in cmdline mode (zeertzjq).

closes: #20128

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/popupwin.c
src/testdir/dumps/Test_customlist_info_popup_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_customlist_info_popup_2.dump [new file with mode: 0644]
src/testdir/dumps/Test_customlist_info_popup_3.dump [new file with mode: 0644]
src/testdir/dumps/Test_customlist_info_popup_4.dump [new file with mode: 0644]
src/testdir/dumps/Test_customlist_info_popup_5.dump [new file with mode: 0644]
src/testdir/test_cmdline.vim
src/version.c

index fb6e17d058c45e95669e1dfcda439f94e75369c8..f019943805cb9ba9811deb7fbc8333ed4c3533dd 100644 (file)
@@ -5894,6 +5894,10 @@ popup_hide_info(void)
     {
        popup_on_cmdline = wp->w_popup_flags & POPF_ON_CMDLINE;
        popup_hide(wp);
+       if (State & MODE_CMDLINE)
+           // Cmdline mode doesn't normally call update_screen(), so it's
+           // necessary to use pum_call_update_screen() here.
+           pum_call_update_screen();
     }
 }
 
diff --git a/src/testdir/dumps/Test_customlist_info_popup_1.dump b/src/testdir/dumps/Test_customlist_info_popup_1.dump
new file mode 100644 (file)
index 0000000..0bb1ddb
--- /dev/null
@@ -0,0 +1,12 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @26|╔+0#0000001#e0e0e08|═@12|X| +0#4040ff13#ffffff0@31
+|~| @6| +0#0000001#e0e0e08|a|p@1|l|e| @1|f| |f|r|u|i|t| @4|║| |A| |r|e|d| |f|r|u|i|t| |║| +0#4040ff13#ffffff0@31
+|~| @6| +0#0000001#ffd7ff255|b|a|n|a|n|a| |f| |f|r|u|i|t| @4|╚+0&#e0e0e08|═@12|⇲| +0#4040ff13#ffffff0@31
+|~| @6| +0#0000001#ffd7ff255|c|a|r@1|o|t| |v| |v|e|g|e|t|a|b|l|e| | +0#4040ff13#ffffff0@46
+|~| @6| +0#0000001#ffd7ff255|p|l|a|i|n| @13| +0#4040ff13#ffffff0@46
+|:+0#0000000&|D|i|c|t|C|m|d| |a|p@1|l|e> @60
diff --git a/src/testdir/dumps/Test_customlist_info_popup_2.dump b/src/testdir/dumps/Test_customlist_info_popup_2.dump
new file mode 100644 (file)
index 0000000..3959110
--- /dev/null
@@ -0,0 +1,12 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @6| +0#0000001#ffd7ff255|a|p@1|l|e| @1|f| |f|r|u|i|t| @4|╔+0&#e0e0e08|═@15|X| +0#4040ff13#ffffff0@28
+|~| @6| +0#0000001#e0e0e08|b|a|n|a|n|a| |f| |f|r|u|i|t| @4|║| |A| |y|e|l@1|o|w| |f|r|u|i|t| |║| +0#4040ff13#ffffff0@28
+|~| @6| +0#0000001#ffd7ff255|c|a|r@1|o|t| |v| |v|e|g|e|t|a|b|l|e| |╚+0&#e0e0e08|═@15|⇲| +0#4040ff13#ffffff0@28
+|~| @6| +0#0000001#ffd7ff255|p|l|a|i|n| @13| +0#4040ff13#ffffff0@46
+|:+0#0000000&|D|i|c|t|C|m|d| |b|a|n|a|n|a> @59
diff --git a/src/testdir/dumps/Test_customlist_info_popup_3.dump b/src/testdir/dumps/Test_customlist_info_popup_3.dump
new file mode 100644 (file)
index 0000000..f67d860
--- /dev/null
@@ -0,0 +1,12 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @6| +0#0000001#ffd7ff255|a|p@1|l|e| @1|f| |f|r|u|i|t| @4| +0#4040ff13#ffffff0@46
+|~| @6| +0#0000001#ffd7ff255|b|a|n|a|n|a| |f| |f|r|u|i|t| @4|╔+0&#e0e0e08|═@20|X| +0#4040ff13#ffffff0@23
+|~| @6| +0#0000001#e0e0e08|c|a|r@1|o|t| |v| |v|e|g|e|t|a|b|l|e| |║| |A|n| |o|r|a|n|g|e| |v|e|g|e|t|a|b|l|e| |║| +0#4040ff13#ffffff0@23
+|~| @6| +0#0000001#ffd7ff255|p|l|a|i|n| @13|╚+0&#e0e0e08|═@20|⇲| +0#4040ff13#ffffff0@23
+|:+0#0000000&|D|i|c|t|C|m|d| |c|a|r@1|o|t> @59
diff --git a/src/testdir/dumps/Test_customlist_info_popup_4.dump b/src/testdir/dumps/Test_customlist_info_popup_4.dump
new file mode 100644 (file)
index 0000000..0092776
--- /dev/null
@@ -0,0 +1,12 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @6| +0#0000001#ffd7ff255|a|p@1|l|e| @1|f| |f|r|u|i|t| @4| +0#4040ff13#ffffff0@46
+|~| @6| +0#0000001#ffd7ff255|b|a|n|a|n|a| |f| |f|r|u|i|t| @4| +0#4040ff13#ffffff0@46
+|~| @6| +0#0000001#ffd7ff255|c|a|r@1|o|t| |v| |v|e|g|e|t|a|b|l|e| | +0#4040ff13#ffffff0@46
+|~| @6| +0#0000001#e0e0e08|p|l|a|i|n| @13| +0#4040ff13#ffffff0@46
+|:+0#0000000&|D|i|c|t|C|m|d| |p|l|a|i|n> @60
diff --git a/src/testdir/dumps/Test_customlist_info_popup_5.dump b/src/testdir/dumps/Test_customlist_info_popup_5.dump
new file mode 100644 (file)
index 0000000..37242ae
--- /dev/null
@@ -0,0 +1,12 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @6| +0#0000001#ffd7ff255|a|p@1|l|e| @1|f| |f|r|u|i|t| @4| +0#4040ff13#ffffff0@46
+|~| @6| +0#0000001#ffd7ff255|b|a|n|a|n|a| |f| |f|r|u|i|t| @4| +0#4040ff13#ffffff0@46
+|~| @6| +0#0000001#ffd7ff255|c|a|r@1|o|t| |v| |v|e|g|e|t|a|b|l|e| | +0#4040ff13#ffffff0@46
+|~| @6| +0#0000001#ffd7ff255|p|l|a|i|n| @13| +0#4040ff13#ffffff0@46
+|:+0#0000000&|D|i|c|t|C|m|d| > @65
index efe73a1e6f4bdef8f05b8c3b1a7a917ac7322e01..d58ff2b6d00efdc921f9b7c13a26313933909c40 100644 (file)
@@ -4641,6 +4641,49 @@ func Test_customlist_dict_completion()
   delfunc DictCompAbbr
 endfunc
 
+func Test_customlist_dict_completion_info_popup()
+  CheckScreendump
+
+  let lines =<< trim END
+    func DictComp(A, L, P)
+      return [
+            \ {'word': 'apple',  'kind': 'f', 'menu': 'fruit',     'info': 'A red fruit'},
+            \ {'word': 'banana', 'kind': 'f', 'menu': 'fruit',     'info': 'A yellow fruit'},
+            \ {'word': 'carrot', 'kind': 'v', 'menu': 'vegetable', 'info': 'An orange vegetable'},
+            \ 'plain',
+            \ ]
+    endfunc
+    command -nargs=1 -complete=customlist,DictComp DictCmd echo <q-args>
+    set wildmenu wildoptions=pum completeopt=menu,popup
+  END
+  call writefile(lines, 'XTest_customlist_info_popup', 'D')
+  let rows = 12
+  let buf = RunVimInTerminal('-S XTest_customlist_info_popup', {'rows': rows})
+
+  call term_sendkeys(buf, ":DictCmd \<Tab>")
+  call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':DictCmd apple') + 1)], g:test_timeout, ((rows - 4), 'A red fruit'))
+  call VerifyScreenDump(buf, 'Test_customlist_info_popup_1', {})
+
+  call term_sendkeys(buf, "\<Tab>")
+  call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':DictCmd banana') + 1)], g:test_timeout, ((rows - 3), 'A yellow fruit'))
+  call VerifyScreenDump(buf, 'Test_customlist_info_popup_2', {})
+
+  call term_sendkeys(buf, "\<Tab>")
+  call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':DictCmd carrot') + 1)], g:test_timeout, ((rows - 2), 'An orange vegetable'))
+  call VerifyScreenDump(buf, 'Test_customlist_info_popup_3', {})
+
+  call term_sendkeys(buf, "\<Tab>")
+  call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':DictCmd plain') + 1)], g:test_timeout, ((rows - 1), '^\~\s\+plain\s\+$'))
+  call VerifyScreenDump(buf, 'Test_customlist_info_popup_4', {})
+
+  call term_sendkeys(buf, "\<Tab>")
+  call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':DictCmd ') + 1)], g:test_timeout)
+  call VerifyScreenDump(buf, 'Test_customlist_info_popup_5', {})
+
+  call term_sendkeys(buf, "\<Esc>")
+  call StopVimInTerminal(buf)
+endfunc
+
 func Test_custom_completion_with_glob()
   func TestGlobComplete(A, L, P)
     return split(glob('Xglob*'), "\n")
index 59084a36250db834e89c2a0cbf7d825be00557cd..81809c9ea467eff68f3586430fe189106473be2a 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    439,
 /**/
     438,
 /**/