mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
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 #3789)
This commit is contained in:
31
src/edit.c
31
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. */
|
||||
|
Reference in New Issue
Block a user