vim-patch:9.1.1771: complete: some redraw issues with 'autocomplete'

Problem:  complete: some redraw issues with 'autocomplete'
Solution: Fix the issues (Girish Palya)

This commit contains the following changes:
* Fix that wildtrigger() might leave opened popupmenu around vim/vim#18298
* Remove blinking message on the command line when a menu item from a loaded
  buffer is selected during 'autocomplete'
* Add a test for PR vim/vim#18265 to demonstrate why the PR is required for correct
  'autocomplete' behavior

fixes: vim/vim#18298
closes: vim/vim#18328

ee9a2f0512

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-09-19 09:48:17 +08:00
parent dd306bd48a
commit 0763a85f43
5 changed files with 69 additions and 11 deletions

View File

@@ -1241,10 +1241,11 @@ static int command_line_wildchar_complete(CommandLineState *s)
return (res == OK) ? CMDLINE_CHANGED : CMDLINE_NOT_CHANGED;
}
static void command_line_end_wildmenu(CommandLineState *s)
static void command_line_end_wildmenu(CommandLineState *s, bool key_is_wc)
{
if (cmdline_pum_active()) {
s->skip_pum_redraw = (s->skip_pum_redraw
s->skip_pum_redraw = (s->skip_pum_redraw && !key_is_wc
&& !ascii_iswhite(s->c)
&& (vim_isprintc(s->c)
|| s->c == K_BS || s->c == Ctrl_H || s->c == K_DEL
|| s->c == K_KDEL || s->c == Ctrl_W || s->c == Ctrl_U));
@@ -1301,7 +1302,7 @@ static int command_line_execute(VimState *state, int key)
nextwild(&s->xpc, WILD_PUM_WANT, 0, s->firstc != '@');
if (pum_want.finish) {
nextwild(&s->xpc, WILD_APPLY, WILD_NO_BEEP, s->firstc != '@');
command_line_end_wildmenu(s);
command_line_end_wildmenu(s, false);
}
}
pum_want.active = false;
@@ -1408,7 +1409,7 @@ static int command_line_execute(VimState *state, int key)
// free expanded names when finished walking through matches
if (end_wildmenu) {
command_line_end_wildmenu(s);
command_line_end_wildmenu(s, key_is_wc);
}
if (p_wmnu) {

View File

@@ -5189,12 +5189,14 @@ static void ins_compl_show_filename(void)
MB_PTR_ADV(s);
}
}
msg_hist_off = true;
vim_snprintf(IObuff, IOSIZE, "%s %s%s", lead,
s > compl_shown_match->cp_fname ? "<" : "", s);
msg(IObuff, 0);
msg_hist_off = false;
redraw_cmdline = false; // don't overwrite!
if (!compl_autocomplete) {
msg_hist_off = true;
vim_snprintf(IObuff, IOSIZE, "%s %s%s", lead,
s > compl_shown_match->cp_fname ? "<" : "", s);
msg(IObuff, 0);
msg_hist_off = false;
redraw_cmdline = false; // don't overwrite!
}
}
/// Find the appropriate completion item when 'complete' ('cpt') includes