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 #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 #18265 to demonstrate why the PR is required for correct
  'autocomplete' behavior

fixes: #18298
closes: #18328

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-09-18 19:46:01 +00:00
committed by Christian Brabandt
parent 6bea124137
commit ee9a2f0512
6 changed files with 49 additions and 7 deletions

View File

@ -2037,6 +2037,7 @@ getcmdline_int(
if (cmdline_pum_active())
{
skip_pum_redraw = skip_pum_redraw && !key_is_wc
&& !VIM_ISWHITE(c)
&& (vim_isprintc(c)
|| c == K_BS || c == Ctrl_H || c == K_DEL
|| c == K_KDEL || c == Ctrl_W || c == Ctrl_U);

View File

@ -6007,12 +6007,15 @@ ins_compl_show_filename(void)
MB_PTR_ADV(s);
}
}
msg_hist_off = TRUE;
vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead,
s > compl_shown_match->cp_fname ? "<" : "", s);
msg((char *)IObuff);
msg_hist_off = FALSE;
redraw_cmdline = FALSE; // don't overwrite!
if (!compl_autocomplete)
{
msg_hist_off = TRUE;
vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead,
s > compl_shown_match->cp_fname ? "<" : "", s);
msg((char *)IObuff);
msg_hist_off = FALSE;
redraw_cmdline = FALSE; // don't overwrite!
}
}
/*

View File

@ -0,0 +1,10 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|:+0#0000000&|t|e|r|m| |f|o@1> @65

View File

@ -5088,4 +5088,23 @@ func Test_skip_wildtrigger_hist_navigation()
cunmap <Down>
endfunc
" Issue 18298: wildmenu should be dismissed after wildtrigger and whitespace
func Test_update_screen_after_wildtrigger()
CheckScreendump
let lines =<< trim [SCRIPT]
call test_override("char_avail", 1)
set wildmode=noselect:lastused,full wildmenu wildoptions=pum
autocmd CmdlineChanged : if getcmdcompltype() != 'shellcmd' | call wildtrigger() | endif
[SCRIPT]
call writefile(lines, 'XTest_wildtrigger', 'D')
let buf = RunVimInTerminal('-S XTest_wildtrigger', {'rows': 10})
call term_sendkeys(buf, ":term foo")
call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_update_screen_wildtrigger_1', {})
call term_sendkeys(buf, "\<esc>")
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@ -5247,7 +5247,7 @@ func Test_autocomplete_trigger()
call feedkeys("Sazx\<Left>\<BS>\<F2>\<Esc>0", 'tx!')
call assert_equal(['and', 'afoo'], b:matches->mapnew('v:val.word'))
" Test 6: <BS> should clear the selected item
" Test 6: <BS> should clear the selected item (PR #18265)
%d
call setline(1, ["foobarfoo", "foobar", "foobarbaz"])
call feedkeys("Gofo\<C-N>\<C-N>\<F2>\<F3>\<Esc>0", 'tx!')
@ -5262,6 +5262,13 @@ func Test_autocomplete_trigger()
call assert_equal(0, b:selected)
call assert_equal('foobarbaz', getline(4))
" Test 7: Remove selection when menu contents change (PR #18265)
%d
call setline(1, ["foobar", "fodxyz", "fodabc"])
call feedkeys("Gofoo\<C-N>\<BS>\<BS>\<BS>\<BS>d\<F2>\<F3>\<Esc>0", 'tx!')
call assert_equal(['fodabc', 'fodxyz'], b:matches->mapnew('v:val.word'))
call assert_equal(-1, b:selected)
bw!
call test_override("char_avail", 0)
delfunc NonKeywordComplete

View File

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