From 9a9bb9186a9f1596b1b501719b495a536065a4f3 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 17 Jan 2020 22:06:44 -0500 Subject: vim-patch:8.1.0716: get warning message when 'completefunc' returns nothing Problem: Get warning message when 'completefunc' returns nothing. Solution: Allow for returning v:none to suppress the warning message. (Yasuhiro Matsumoto, closes vim/vim#3789) https://github.com/vim/vim/commit/cee9bc2e3dc5c16a9d2a8d0e23aa0d5fdefa3a4a --- src/nvim/edit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/edit.c') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index cdb4b127da..9bc00cf2aa 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3747,6 +3747,8 @@ expand_by_function( case VAR_DICT: matchdict = rettv.vval.v_dict; break; + case VAR_SPECIAL: + FALLTHROUGH; default: // TODO(brammool): Give error message? tv_clear(&rettv); @@ -5210,7 +5212,7 @@ static int ins_complete(int c, bool enable_pum) } } - /* Show a message about what (completion) mode we're in. */ + // Show a message about what (completion) mode we're in. showmode(); if (!shortmess(SHM_COMPLETIONMENU)) { if (edit_submode_extra != NULL) { -- cgit From ad35cbca76222deb33357b63a61a29945ef084f7 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 17 Jan 2020 23:31:18 -0500 Subject: 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. https://github.com/vim/vim/commit/17e04781f26c24769e202351c194ee252927eee1 --- src/nvim/edit.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/nvim/edit.c') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 9bc00cf2aa..0c183add16 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -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 -- cgit