0
0
mirror of https://github.com/vim/vim.git synced 2025-07-25 10:54:51 -04:00

patch 9.1.1200: cmdline pum not cleared for input() completion

Problem:  Cmdline pum not cleared for input() completion.
Solution: Temporary reset RedrawingDisabled in cmdline_pum_cleanup(),
          like what is done in wildmenu_cleanup() (zeertzjq).

fixes: #16874
closes: #16876

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq 2025-03-13 20:29:13 +01:00 committed by Christian Brabandt
parent 0adbe639a5
commit 1830e787f6
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
13 changed files with 112 additions and 6 deletions

View File

@ -419,10 +419,15 @@ cmdline_pum_active(void)
* items and refresh the screen.
*/
void
cmdline_pum_remove(void)
cmdline_pum_remove(cmdline_info_T *cclp UNUSED)
{
int save_p_lz = p_lz;
int save_KeyTyped = KeyTyped;
#ifdef FEAT_EVAL
int save_RedrawingDisabled = RedrawingDisabled;
if (cclp->input_fn)
RedrawingDisabled = 0;
#endif
pum_undisplay();
VIM_CLEAR(compl_match_array);
@ -434,12 +439,16 @@ cmdline_pum_remove(void)
// When a function is called (e.g. for 'foldtext') KeyTyped might be reset
// as a side effect.
KeyTyped = save_KeyTyped;
#ifdef FEAT_EVAL
if (cclp->input_fn)
RedrawingDisabled = save_RedrawingDisabled;
#endif
}
void
cmdline_pum_cleanup(cmdline_info_T *cclp)
{
cmdline_pum_remove();
cmdline_pum_remove(cclp);
wildmenu_cleanup(cclp);
}
@ -1022,7 +1031,7 @@ ExpandOne(
// The entries from xp_files may be used in the PUM, remove it.
if (compl_match_array != NULL)
cmdline_pum_remove();
cmdline_pum_remove(get_cmdline_info());
}
xp->xp_selected = 0;

View File

@ -1930,7 +1930,7 @@ getcmdline_int(
if (end_wildmenu)
{
if (cmdline_pum_active())
cmdline_pum_remove();
cmdline_pum_remove(&ccline);
if (xpc.xp_numfiles != -1)
(void)ExpandOne(&xpc, NULL, NULL, 0, WILD_FREE);
did_wild_list = FALSE;
@ -2556,7 +2556,7 @@ returncmd:
// if certain special keys like <Esc> or <C-\> were used as wildchar. Make
// sure to still clean up to avoid memory corruption.
if (cmdline_pum_active())
cmdline_pum_remove();
cmdline_pum_remove(&ccline);
wildmenu_cleanup(&ccline);
did_wild_list = FALSE;
wim_index = 0;

View File

@ -3,7 +3,7 @@ int cmdline_fuzzy_complete(char_u *fuzzystr);
int nextwild(expand_T *xp, int type, int options, int escape);
void cmdline_pum_display(void);
int cmdline_pum_active(void);
void cmdline_pum_remove(void);
void cmdline_pum_remove(cmdline_info_T *cclp);
void cmdline_pum_cleanup(cmdline_info_T *cclp);
int cmdline_compl_startcol(void);
char_u *cmdline_compl_pattern(void);

View File

@ -0,0 +1,8 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|C+0#0000000&|o|m@1|a|n|d|?| > @65

View File

@ -0,0 +1,8 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|e+0#0000001#ffff4012|c|h|o| +3#0000000#ffffff0@1|e|c|h|o|c|o|n|s|o|l|e| @1|e|c|h|o|e|r@1| @1|e|c|h|o|h|l| @1|e|c|h|o|m|s|g| @1|e|c|h|o|n| @1|e|c|h|o|w|i|n|d|o|w| @12
|C+0&&|o|m@1|a|n|d|?| |e|c|h|o> @61

View File

@ -0,0 +1,8 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|C+0#0000000&|o|m@1|a|n|d|?| |e|c|h|o| > @60

View File

@ -0,0 +1,8 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|b+0#0000001#ffff4012|u|f|n|a|m|e|(| +3#0000000#ffffff0@1|b|u|f|n|r|(| @58
|C+0&&|o|m@1|a|n|d|?| |e|c|h|o| |b|u|f|n|a|m|e|(> @52

View File

@ -0,0 +1,8 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|C+0#0000000&|o|m@1|a|n|d|?| > @65

View File

@ -0,0 +1,8 @@
| +0#0000001#e0e0e08|e|c|h|o| @10| +0#0000000#ffffff0@58
| +0#0000001#ffd7ff255|e|c|h|o|c|o|n|s|o|l|e| @3| +0#4040ff13#ffffff0@58
| +0#0000001#ffd7ff255|e|c|h|o|e|r@1| @7| +0#4040ff13#ffffff0@58
| +0#0000001#ffd7ff255|e|c|h|o|h|l| @8| +0#4040ff13#ffffff0@58
| +0#0000001#ffd7ff255|e|c|h|o|m|s|g| @7| +0#4040ff13#ffffff0@58
| +0#0000001#ffd7ff255|e|c|h|o|n| @9| +0#4040ff13#ffffff0@58
| +0#0000001#ffd7ff255|e|c|h|o|w|i|n|d|o|w| @4| +0#4040ff13#ffffff0@58
|C+0#0000000&|o|m@1|a|n|d|?| |e|c|h|o> @61

View File

@ -0,0 +1,8 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|C+0#0000000&|o|m@1|a|n|d|?| |e|c|h|o| > @60

View File

@ -0,0 +1,8 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @3| +0#0000001#e0e0e08|b|u|f|n|a|m|e|(| @6| +0#4040ff13#ffffff0@53
|~| @3| +0#0000001#ffd7ff255|b|u|f|n|r|(| @8| +0#4040ff13#ffffff0@53
|C+0#0000000&|o|m@1|a|n|d|?| |e|c|h|o| |b|u|f|n|a|m|e|(> @52

View File

@ -211,6 +211,37 @@ func Test_wildmenu_screendump()
call StopVimInTerminal(buf)
endfunc
func Test_wildmenu_with_input_func()
CheckScreendump
let buf = RunVimInTerminal('-c "set wildmenu"', {'rows': 8})
call term_sendkeys(buf, ":call input('Command? ', '', 'command')\<CR>")
call VerifyScreenDump(buf, 'Test_wildmenu_input_func_1', {})
call term_sendkeys(buf, "ech\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_input_func_2', {})
call term_sendkeys(buf, "\<Space>")
call VerifyScreenDump(buf, 'Test_wildmenu_input_func_3', {})
call term_sendkeys(buf, "bufn\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_input_func_4', {})
call term_sendkeys(buf, "\<CR>")
call term_sendkeys(buf, ":set wildoptions+=pum\<CR>")
call term_sendkeys(buf, ":call input('Command? ', '', 'command')\<CR>")
call VerifyScreenDump(buf, 'Test_wildmenu_input_func_5', {})
call term_sendkeys(buf, "ech\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_input_func_6', {})
call term_sendkeys(buf, "\<Space>")
call VerifyScreenDump(buf, 'Test_wildmenu_input_func_7', {})
call term_sendkeys(buf, "bufn\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_input_func_8', {})
call term_sendkeys(buf, "\<CR>")
" clean up
call StopVimInTerminal(buf)
endfunc
func Test_redraw_in_autocmd()
CheckScreendump

View File

@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1200,
/**/
1199,
/**/