autocmd: rename MenuPopupChanged to CompleteChanged #9819

This commit is contained in:
Qiming zhao 2019-03-31 08:15:41 +08:00 committed by Justin M. Keyes
parent c76494d8b7
commit 9e52255de2
5 changed files with 28 additions and 28 deletions

View File

@ -354,7 +354,7 @@ Name triggered by ~
|SessionLoadPost| after loading a session file |SessionLoadPost| after loading a session file
|MenuPopup| just before showing the popup menu |MenuPopup| just before showing the popup menu
|MenuPopupChanged| after popup menu changed, not fired on popup menu hide |CompleteChanged| after popup menu changed, not fired on popup menu hide
|CompleteDone| after Insert mode completion is done |CompleteDone| after Insert mode completion is done
|User| to be used in combination with ":doautocmd" |User| to be used in combination with ":doautocmd"
@ -589,6 +589,22 @@ CompleteDone After Insert mode completion is done. Either
The |v:completed_item| variable contains the The |v:completed_item| variable contains the
completed item. completed item.
CompleteChanged *CompleteChanged*
After each time popup menu changed, not fired
on popup menu hide, use |CompleteDone| for popup
menu hide.
Sets these |v:event| keys:
completed_item
height
width
row
col
size
scrollbar
It is not allowed to change the text |textlock|.
*CursorHold* *CursorHold*
CursorHold When the user doesn't press a key for the time CursorHold When the user doesn't press a key for the time
specified with 'updatetime'. Not re-triggered specified with 'updatetime'. Not re-triggered
@ -853,22 +869,6 @@ MenuPopup Just before showing the popup menu (under the
o Operator-pending o Operator-pending
i Insert i Insert
c Command line c Command line
MenuPopupChanged *MenuPopupChanged*
After each time popup menu changed, not fired
on popup menu hide, use |CompleteDone| for popup
menu hide.
Sets these |v:event| keys:
completed_item
height
width
row
col
size
scrollbar
It is not allowed to change the text |textlock|.
*OptionSet* *OptionSet*
OptionSet After setting an option (except during OptionSet After setting an option (except during
|startup|). The |autocmd-pattern| is matched |startup|). The |autocmd-pattern| is matched

View File

@ -1554,16 +1554,16 @@ v:event Dictionary of event data for the current |autocommand|. Valid
regtype Type of register as returned by regtype Type of register as returned by
|getregtype()|. |getregtype()|.
completed_item Current selected complete item on completed_item Current selected complete item on
|MenuPopupChanged|, Is `{}` when no complete |CompleteChanged|, Is `{}` when no complete
item selected. item selected.
height Height of popup menu on |MenuPopupChanged| height Height of popup menu on |CompleteChanged|
width width of popup menu on |MenuPopupChanged| width width of popup menu on |CompleteChanged|
row Row count of popup menu on |MenuPopupChanged|, row Row count of popup menu on |CompleteChanged|,
relative to screen. relative to screen.
col Col count of popup menu on |MenuPopupChanged|, col Col count of popup menu on |CompleteChanged|,
relative to screen. relative to screen.
size Total number of completion items on size Total number of completion items on
|MenuPopupChanged|. |CompleteChanged|.
scrollbar Is |v:true| if popup menu have scrollbar, or scrollbar Is |v:true| if popup menu have scrollbar, or
|v:false| if not. |v:false| if not.

View File

@ -29,6 +29,7 @@ return {
'CmdWinLeave', -- before leaving the cmdline window 'CmdWinLeave', -- before leaving the cmdline window
'ColorScheme', -- after loading a colorscheme 'ColorScheme', -- after loading a colorscheme
'ColorSchemePre', -- before loading a colorscheme 'ColorSchemePre', -- before loading a colorscheme
'CompleteChanged', -- after popup menu changed
'CompleteDone', -- after finishing insert complete 'CompleteDone', -- after finishing insert complete
'CursorHold', -- cursor in same position for a while 'CursorHold', -- cursor in same position for a while
'CursorHoldI', -- idem, in Insert mode 'CursorHoldI', -- idem, in Insert mode
@ -66,7 +67,6 @@ return {
'InsertLeave', -- when leaving Insert mode 'InsertLeave', -- when leaving Insert mode
'JobActivity', -- when job sent some data 'JobActivity', -- when job sent some data
'MenuPopup', -- just before popup menu is displayed 'MenuPopup', -- just before popup menu is displayed
'MenuPopupChanged', -- after popup menu changed
'OptionSet', -- after setting any option 'OptionSet', -- after setting any option
'QuickFixCmdPost', -- after :make, :grep etc. 'QuickFixCmdPost', -- after :make, :grep etc.
'QuickFixCmdPre', -- before :make, :grep etc. 'QuickFixCmdPre', -- before :make, :grep etc.

View File

@ -2681,7 +2681,7 @@ void ins_compl_show_pum(void)
pum_display(compl_match_array, compl_match_arraysize, cur, array_changed, 0); pum_display(compl_match_array, compl_match_arraysize, cur, array_changed, 0);
curwin->w_cursor.col = col; curwin->w_cursor.col = col;
if (!has_event(EVENT_MENUPOPUPCHANGED)) { if (!has_event(EVENT_COMPLETECHANGED)) {
return; return;
} }
dict_T *dict = get_vim_var_dict(VV_EVENT); dict_T *dict = get_vim_var_dict(VV_EVENT);
@ -2694,7 +2694,7 @@ void ins_compl_show_pum(void)
pum_set_boundings(dict); pum_set_boundings(dict);
tv_dict_set_keys_readonly(dict); tv_dict_set_keys_readonly(dict);
textlock++; textlock++;
apply_autocmds(EVENT_MENUPOPUPCHANGED, NULL, NULL, false, curbuf); apply_autocmds(EVENT_COMPLETECHANGED, NULL, NULL, false, curbuf);
textlock--; textlock--;
tv_dict_clear(dict); tv_dict_clear(dict);
} }

View File

@ -1073,7 +1073,7 @@ describe('completion', function()
]]) ]])
end) end)
it('MenuPopupChanged autocommand', function() it('CompleteChanged autocommand', function()
curbufmeths.set_lines(0, 1, false, { 'foo', 'bar', 'foobar', ''}) curbufmeths.set_lines(0, 1, false, { 'foo', 'bar', 'foobar', ''})
source([[ source([[
set complete=. completeopt=noinsert,noselect,menuone set complete=. completeopt=noinsert,noselect,menuone
@ -1082,7 +1082,7 @@ describe('completion', function()
let g:item = get(v:event, 'completed_item', {}) let g:item = get(v:event, 'completed_item', {})
let g:word = get(g:item, 'word', v:null) let g:word = get(g:item, 'word', v:null)
endfunction endfunction
autocmd! MenuPopupChanged * :call OnPumChange() autocmd! CompleteChanged * :call OnPumChange()
call cursor(4, 1) call cursor(4, 1)
]]) ]])