summaryrefslogtreecommitdiff
path: root/src/insexpand.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-17 18:58:59 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-17 18:58:59 +0100
commit17e04781f26c24769e202351c194ee252927eee1 (patch)
tree05c1e56ae9d9d329e7b1b2f9cf2318bad6c372f3 /src/insexpand.c
parentf2a44e5c48b029666ded556e2ab052dfc1266d62 (diff)
downloadvim-git-17e04781f26c24769e202351c194ee252927eee1.tar.gz
patch 8.2.0123: complete_info() does not work when CompleteDone is triggeredv8.2.0123
Problem: complete_info() does not work when CompleteDone is triggered. Solution: Trigger CompleteDone before clearing the info.
Diffstat (limited to 'src/insexpand.c')
-rw-r--r--src/insexpand.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/insexpand.c b/src/insexpand.c
index acddd2658..54f8cb351 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -1813,6 +1813,7 @@ ins_compl_prep(int c)
int want_cindent;
#endif
int retval = FALSE;
+ 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.
@@ -2060,6 +2061,18 @@ ins_compl_prep(int c)
auto_format(FALSE, TRUE);
+ {
+ 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;
@@ -2084,9 +2097,6 @@ ins_compl_prep(int c)
if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0)))
do_c_expr_indent();
#endif
- // 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)