diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-08-30 19:48:24 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-30 19:48:24 +0100 |
commit | 04c4c5746e15884768d2cb41370c3276a196cd4c (patch) | |
tree | 1e629820796635bd332b2066c03d548fad527f89 /src/search.c | |
parent | f240395fca63d4b330112a4b81e94b05b50de1aa (diff) | |
download | vim-git-04c4c5746e15884768d2cb41370c3276a196cd4c.tar.gz |
patch 9.0.0335: checks for Dictionary argument often give a vague errorv9.0.0335
Problem: Checks for Dictionary argument often give a vague error message.
Solution: Give a useful error message. (Yegappan Lakshmanan, closes #11009)
Diffstat (limited to 'src/search.c')
-rw-r--r-- | src/search.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/search.c b/src/search.c index 9f1a80ad8..0c2a990ca 100644 --- a/src/search.c +++ b/src/search.c @@ -764,7 +764,7 @@ searchit( col = at_first_line && (options & SEARCH_COL) ? pos->col : (colnr_T)0; nmatched = vim_regexec_multi(®match, 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. |