1
0
forked from aniani/vim

patch 9.0.0335: checks for Dictionary argument often give a vague error

Problem:    Checks for Dictionary argument often give a vague error message.
Solution:   Give a useful error message. (Yegappan Lakshmanan, closes #11009)
This commit is contained in:
Yegappan Lakshmanan
2022-08-30 19:48:24 +01:00
committed by Bram Moolenaar
parent f240395fca
commit 04c4c5746e
32 changed files with 128 additions and 183 deletions

View File

@@ -764,7 +764,7 @@ searchit(
col = at_first_line && (options & SEARCH_COL) ? pos->col
: (colnr_T)0;
nmatched = vim_regexec_multi(&regmatch, win, buf,
lnum, col, timed_out);
lnum, col, timed_out);
// vim_regexec_multi() may clear "regprog"
if (regmatch.regprog == NULL)
break;
@@ -1072,11 +1072,11 @@ searchit(
* twice.
*/
if (!p_ws || stop_lnum != 0 || got_int
|| called_emsg > called_emsg_before || *timed_out
|| called_emsg > called_emsg_before || *timed_out
#ifdef FEAT_SEARCH_EXTRA
|| break_loop
|| break_loop
#endif
|| found || loop)
|| found || loop)
break;
/*
@@ -4095,11 +4095,8 @@ f_searchcount(typval_T *argvars, typval_T *rettv)
listitem_T *li;
int error = FALSE;
if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL)
{
emsg(_(e_dictionary_required));
if (check_for_nonnull_dict_arg(argvars, 0) == FAIL)
return;
}
dict = argvars[0].vval.v_dict;
di = dict_find(dict, (char_u *)"timeout", -1);
if (di != NULL)
@@ -4815,11 +4812,8 @@ do_fuzzymatch(typval_T *argvars, typval_T *rettv, int retmatchpos)
dict_T *d;
dictitem_T *di;
if (argvars[2].v_type != VAR_DICT || argvars[2].vval.v_dict == NULL)
{
emsg(_(e_dictionary_required));
if (check_for_nonnull_dict_arg(argvars, 2) == FAIL)
return;
}
// To search a dict, either a callback function or a key can be
// specified.