vim-patch:8.1.0057: popup menu displayed wrong when using autocmd

Problem:    Popup menu displayed wrong when using autocmd.
Solution:   Use aucmd_prepbuf().  Force updating status line if the popup menu
            is going to be redrawn anyway. (Christian Brabandt, closes vim/vim#3009)
6ba3ec1bac
This commit is contained in:
Jason Felice
2018-08-08 20:51:49 -07:00
parent cf9dd7a3f4
commit 0a8be9f8ef
2 changed files with 19 additions and 7 deletions

View File

@@ -1390,7 +1390,12 @@ ins_redraw (
if (ready && has_event(EVENT_TEXTCHANGEDI)
&& curbuf->b_last_changedtick != buf_get_changedtick(curbuf)
&& !pum_visible()) {
aco_save_T aco;
// save and restore curwin and curbuf, in case the autocmd changes them
aucmd_prepbuf(&aco, curbuf);
apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, false, curbuf);
aucmd_restbuf(&aco);
curbuf->b_last_changedtick = buf_get_changedtick(curbuf);
}
@@ -1400,8 +1405,13 @@ ins_redraw (
if (ready && has_event(EVENT_TEXTCHANGEDP)
&& curbuf->b_last_changedtick_pum != buf_get_changedtick(curbuf)
&& pum_visible()) {
apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, false, curbuf);
curbuf->b_last_changedtick_pum = buf_get_changedtick(curbuf);
aco_save_T aco;
// save and restore curwin and curbuf, in case the autocmd changes them
aucmd_prepbuf(&aco, curbuf);
apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, false, curbuf);
aucmd_restbuf(&aco);
curbuf->b_last_changedtick_pum = buf_get_changedtick(curbuf);
}
if (must_redraw)