summaryrefslogtreecommitdiff
path: root/src/edit.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-11 13:02:23 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-11 13:02:23 +0100
commitcee9bc2e3dc5c16a9d2a8d0e23aa0d5fdefa3a4a (patch)
tree3459c3d301a0dfcb6669b6e5aa3b50597ccb0c0e /src/edit.c
parent6f7e555f7440df148350468ad8bc6d559d676d7c (diff)
downloadvim-git-cee9bc2e3dc5c16a9d2a8d0e23aa0d5fdefa3a4a.tar.gz
patch 8.1.0716: get warning message when 'completefunc' returns nothingv8.1.0716
Problem: Get warning message when 'completefunc' returns nothing. Solution: Allow for returning v:none to suppress the warning message. (Yasuhiro Matsumoto, closes #3789)
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/edit.c b/src/edit.c
index bd840d147..bd6f606bb 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -150,6 +150,7 @@ static int compl_cont_mode = 0;
static expand_T compl_xp;
static int compl_opt_refresh_always = FALSE;
+static int compl_opt_suppress_empty = FALSE;
static void ins_ctrl_x(void);
static int has_compl_option(int dict_opt);
@@ -4247,8 +4248,12 @@ expand_by_function(
case VAR_DICT:
matchdict = rettv.vval.v_dict;
break;
+ case VAR_SPECIAL:
+ if (rettv.vval.v_number == VVAL_NONE)
+ compl_opt_suppress_empty = TRUE;
+ // FALLTHROUGH
default:
- /* TODO: Give error message? */
+ // TODO: Give error message?
clear_tv(&rettv);
break;
}
@@ -5611,6 +5616,7 @@ ins_complete(int c, int enable_pum)
* completion.
*/
compl_opt_refresh_always = FALSE;
+ compl_opt_suppress_empty = FALSE;
if (col < 0)
col = curs_col;
@@ -5860,19 +5866,22 @@ ins_complete(int c, int enable_pum)
}
}
- /* Show a message about what (completion) mode we're in. */
- showmode();
- if (!shortmess(SHM_COMPLETIONMENU))
+ // Show a message about what (completion) mode we're in.
+ if (!compl_opt_suppress_empty)
{
- if (edit_submode_extra != NULL)
+ showmode();
+ if (!shortmess(SHM_COMPLETIONMENU))
{
- if (!p_smd)
- msg_attr(edit_submode_extra,
- edit_submode_highl < HLF_COUNT
- ? HL_ATTR(edit_submode_highl) : 0);
+ if (edit_submode_extra != NULL)
+ {
+ if (!p_smd)
+ msg_attr(edit_submode_extra,
+ edit_submode_highl < HLF_COUNT
+ ? HL_ATTR(edit_submode_highl) : 0);
+ }
+ else
+ msg_clr_cmdline(); // necessary for "noshowmode"
}
- else
- msg_clr_cmdline(); /* necessary for "noshowmode" */
}
/* Show the popup menu, unless we got interrupted. */