mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.2.0468: popups: not correctly updated from a CmdlineChanged autocommand
Problem: popup_show() from a CmdlineChanged autocommand doesn't update
the screen (Mao-Yining)
Solution: Refresh the screen when popups need redraw
(Yasuhiro Matsumoto).
popup_settext()/popup_show() called from a CmdlineChanged autocommand
did not refresh the screen because cmdline mode normally skips
update_screen(), so async info-popup updates only became visible after
a manual :redraw. Refresh the screen when popups need redrawing right
after the autocommand.
fixes: #20175
closes: #20179
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
5ef1eec5c5
commit
ef1ecc3b61
@@ -2696,7 +2696,17 @@ cmdline_changed:
|
||||
&& (ccline.cmdpos != prev_cmdpos
|
||||
|| (prev_cmdbuff != NULL &&
|
||||
STRCMP(prev_cmdbuff, ccline.cmdbuff) != 0)))
|
||||
{
|
||||
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
|
||||
#ifdef FEAT_PROP_POPUP
|
||||
// Show popup updates from the autocmd without a manual :redraw.
|
||||
if (popup_need_redraw())
|
||||
{
|
||||
update_screen(0);
|
||||
redrawcmd();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Trigger CursorMovedC autocommands.
|
||||
if (ccline.cmdpos != prev_cmdpos)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
| +0&#ffffff0@49
|
||||
|~+0#4040ff13&| @48
|
||||
|~| @48
|
||||
|~| @48
|
||||
|~| @48
|
||||
|~| @48
|
||||
|~| @48
|
||||
|~| @48
|
||||
|~| @48
|
||||
|~| @48
|
||||
|~| @19|╔+0#0000001#e0e0e08|═@5|X| +0#4040ff13#ffffff0@20
|
||||
|~| @3| +0#0000001#e0e0e08|1| @13|║| |d|o|n|e| |║| +0#4040ff13#ffffff0@20
|
||||
|~| @3| +0#0000001#ffd7ff255|2| @13|╚+0&#e0e0e08|═@5|⇲| +0#4040ff13#ffffff0@20
|
||||
|:+0#0000000&|T|e|s|t| |1> @42
|
||||
@@ -3190,6 +3190,48 @@ func Test_wildmenu_pum()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
" Test that popup_settext() from a CmdlineChanged autocmd updates the
|
||||
" cmdline-mode info popup without needing an explicit :redraw (#20175).
|
||||
func Test_wildmenu_pum_info_async_update()
|
||||
CheckScreendump
|
||||
CheckRunVimInTerminal
|
||||
|
||||
let lines =<< trim END
|
||||
vim9script
|
||||
set completeopt=menuone,popup
|
||||
set wildmenu wildoptions=pum wildcharm=<Tab>
|
||||
augroup Test
|
||||
au!
|
||||
au CmdlineChanged : UpdateInfo()
|
||||
augroup END
|
||||
|
||||
def UpdateInfo()
|
||||
if getcmdcompltype() != 'customlist,Complete'
|
||||
return
|
||||
endif
|
||||
var id = popup_findinfo()
|
||||
if id != 0
|
||||
id->popup_settext('done')
|
||||
popup_show(id)
|
||||
endif
|
||||
enddef
|
||||
|
||||
def Complete(_, _, _): list<dict<any>>
|
||||
return [{word: '1', info: 'lazy'}, {word: '2', info: 'lazy'}]
|
||||
enddef
|
||||
|
||||
command! -nargs=1 -complete=customlist,Complete Test echo <args>
|
||||
END
|
||||
call writefile(lines, 'XtestWildmenuInfoAsync', 'D')
|
||||
let buf = RunVimInTerminal('-S XtestWildmenuInfoAsync', #{rows: 14, cols: 50})
|
||||
call term_sendkeys(buf, ":Test \<Tab>")
|
||||
call TermWait(buf, 200)
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_info_async_update', {})
|
||||
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
" Test for wildmenumode() with the cmdline popup menu
|
||||
func Test_wildmenumode_with_pum()
|
||||
set wildmenu
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
468,
|
||||
/**/
|
||||
467,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user