diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/insexpand.c | 16 | ||||
-rw-r--r-- | src/testdir/test_ins_complete.vim | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 17 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) diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index c9d93ceb1..ef5ac72ae 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -183,6 +183,8 @@ func s:CompleteDone_CheckCompletedItemDict() call assert_equal( 'W', v:completed_item[ 'kind' ] ) call assert_equal( 'test', v:completed_item[ 'user_data' ] ) + call assert_equal('function', complete_info().mode) + let s:called_completedone = 1 endfunc diff --git a/src/version.c b/src/version.c index 737b5747a..e3657bfd5 100644 --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 123, +/**/ 122, /**/ 121, |