vim-patch:8.2.0123: complete_info() does not work when CompleteDone is triggered

Problem:    complete_info() does not work when CompleteDone is triggered.
Solution:   Trigger CompleteDone before clearing the info.
17e04781f2
This commit is contained in:
Jan Edmund Lazo
2020-01-17 23:31:18 -05:00
parent 3d0c3148fb
commit ad35cbca76
3 changed files with 17 additions and 3 deletions

View File

@@ -3385,6 +3385,7 @@ static bool ins_compl_prep(int c)
{
char_u *ptr;
bool retval = false;
const int prev_mode = ctrl_x_mode;
/* Forget any previous 'special' messages if this is actually
* a ^X mode key - bar ^R, in which case we wait to see what it gives us.
@@ -3593,6 +3594,18 @@ static bool ins_compl_prep(int c)
auto_format(FALSE, TRUE);
{
const int new_mode = ctrl_x_mode;
// Trigger the CompleteDone event to give scripts a chance to
// act upon the completion. Do this before clearing the info,
// and restore ctrl_x_mode, so that complete_info() can be
// used.
ctrl_x_mode = prev_mode;
ins_apply_autocmds(EVENT_COMPLETEDONE);
ctrl_x_mode = new_mode;
}
ins_compl_free();
compl_started = false;
compl_matches = 0;
@@ -3617,9 +3630,6 @@ static bool ins_compl_prep(int c)
*/
if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0)))
do_c_expr_indent();
/* Trigger the CompleteDone event to give scripts a chance to act
* upon the completion. */
ins_apply_autocmds(EVENT_COMPLETEDONE);
}
} else if (ctrl_x_mode == CTRL_X_LOCAL_MSG)
/* Trigger the CompleteDone event to give scripts a chance to act