diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-23 12:11:05 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-23 17:48:12 +0800 |
commit | a9e6cf0e64ede3fc26226fed3a5f94a7f5020918 (patch) | |
tree | 0abdc8c22d68f6439a56d11cbc65e22000fb1790 /src/nvim/eval/funcs.c | |
parent | ffa1335047047ac00280ac742bcc6dfcc7fa3589 (diff) | |
download | rneovim-a9e6cf0e64ede3fc26226fed3a5f94a7f5020918.tar.gz rneovim-a9e6cf0e64ede3fc26226fed3a5f94a7f5020918.tar.bz2 rneovim-a9e6cf0e64ede3fc26226fed3a5f94a7f5020918.zip |
vim-patch:8.2.4740: when expand() fails there is no error message
Problem: When expand() fails there is no error message.
Solution: When 'verbose' is set give an error message.
https://github.com/vim/vim/commit/575445200bd35283191ecd7a0d596b37c5b477a4
Diffstat (limited to 'src/nvim/eval/funcs.c')
-rw-r--r-- | src/nvim/eval/funcs.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 181b17f747..6ff05b13e8 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -1958,7 +1958,6 @@ static void f_exists(typval_T *argvars, typval_T *rettv, FunPtr fptr) /// "expand()" function static void f_expand(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - char *errormsg; int options = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND; bool error = false; #ifdef BACKSLASH_IN_FILENAME @@ -1978,10 +1977,17 @@ static void f_expand(typval_T *argvars, typval_T *rettv, FunPtr fptr) const char *s = tv_get_string(&argvars[0]); if (*s == '%' || *s == '#' || *s == '<') { - emsg_off++; + if (p_verbose == 0) { + emsg_off++; + } size_t len; + char *errormsg = NULL; char_u *result = eval_vars((char_u *)s, (char_u *)s, &len, NULL, &errormsg, NULL); - emsg_off--; + if (p_verbose == 0) { + emsg_off--; + } else if (errormsg != NULL) { + emsg(errormsg); + } if (rettv->v_type == VAR_LIST) { tv_list_alloc_ret(rettv, (result != NULL)); if (result != NULL) { |