diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-10-27 08:30:27 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-10-27 08:33:55 +0800 |
commit | 1f438b23381cf79e9c6fbdfa69dfeff9ecbce3e6 (patch) | |
tree | 03146b2dc3ad70f5ed8f00aef5d9adb1f5299926 /src | |
parent | bd122494cc3012a4885a55663e7c158c7a402878 (diff) | |
download | rneovim-1f438b23381cf79e9c6fbdfa69dfeff9ecbce3e6.tar.gz rneovim-1f438b23381cf79e9c6fbdfa69dfeff9ecbce3e6.tar.bz2 rneovim-1f438b23381cf79e9c6fbdfa69dfeff9ecbce3e6.zip |
vim-patch:8.2.2726: confusing error message with white space before comma
Problem: Confusing error message with white space before comma in the
arguments of a function declaration.
Solution: Give a specific error message. (closes vim/vim#2235)
https://github.com/vim/vim/commit/86cdb8a4bd1abff40b5f80c3c4149b33cbaab990
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval/userfunc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 7440044e52..2a7ad792df 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -48,6 +48,8 @@ static char *e_funcexts = N_("E122: Function %s already exists, add ! to replace static char *e_funcdict = N_("E717: Dictionary entry already exists"); static char *e_funcref = N_("E718: Funcref required"); static char *e_nofunc = N_("E130: Unknown function: %s"); +static char e_no_white_space_allowed_before_str_str[] + = N_("E1068: No white space allowed before '%s': %s"); void func_init(void) { @@ -149,6 +151,15 @@ static int get_function_args(char **argp, char_u endchar, garray_T *newargs, int emsg(_("E989: Non-default argument follows default argument")); mustend = true; } + + if (ascii_iswhite(*p) && *skipwhite(p) == ',') { + // Be tolerant when skipping + if (!skip) { + semsg(_(e_no_white_space_allowed_before_str_str), ",", p); + goto err_ret; + } + p = skipwhite(p); + } if (*p == ',') { p++; } else { |