0
0
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:
Bram Moolenaar
2019-01-11 13:02:23 +01:00
parent 6f7e555f74
commit cee9bc2e3d
4 changed files with 62 additions and 22 deletions

View File

@@ -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. */