summaryrefslogtreecommitdiffstats
path: root/src/optionstr.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-01-17 20:54:49 +0100
committerChristian Brabandt <cb@256bit.org>2024-01-17 21:07:08 +0100
commit6a8d2e1634f8f0d7463a2786dbcbe0f38dd287a7 (patch)
tree47681288dc7fd7efe9b1ade01e157f10d48e0d6f /src/optionstr.c
parent4ea37f88e8345ca830271636a2e197a1a46114d2 (diff)
patch 9.1.0039: too vague errors for 'listchars'/'fillchars'v9.1.0039
Problem: too vague errors for 'listchars'/'fillchars' Solution: Include the field name in error message. (zeertzjq) related: neovim/neovim#27050 closes: #13877 Co-authored-by: Cole Frankenhoff <cole.nhf@gmail.com> Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/optionstr.c')
-rw-r--r--src/optionstr.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/optionstr.c b/src/optionstr.c
index 65a80afe1a..2d809a3943 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -233,7 +233,7 @@ illegal_char(char *errbuf, size_t errbuflen, int c)
{
if (errbuf == NULL)
return "";
- vim_snprintf((char *)errbuf, errbuflen, _(e_illegal_character_str),
+ vim_snprintf(errbuf, errbuflen, _(e_illegal_character_str),
(char *)transchar(c));
return errbuf;
}
@@ -1350,7 +1350,8 @@ expand_set_clipboard(optexpand_T *args, int *numMatches, char_u ***matches)
* The global 'listchars' or 'fillchars' option is changed.
*/
static char *
-did_set_global_listfillchars(char_u *val, int opt_lcs, int opt_flags)
+did_set_global_listfillchars(char_u *val, int opt_lcs, int opt_flags,
+ char *errbuf, size_t errbuflen)
{
char *errmsg = NULL;
char_u **local_ptr = opt_lcs ? &curwin->w_p_lcs : &curwin->w_p_fcs;
@@ -1359,10 +1360,12 @@ did_set_global_listfillchars(char_u *val, int opt_lcs, int opt_flags)
// local value
if (opt_lcs)
errmsg = set_listchars_option(curwin, val,
- **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
+ **local_ptr == NUL || !(opt_flags & OPT_GLOBAL),
+ errbuf, errbuflen);
else
errmsg = set_fillchars_option(curwin, val,
- **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
+ **local_ptr == NUL || !(opt_flags & OPT_GLOBAL),
+ errbuf, errbuflen);
if (errmsg != NULL)
return errmsg;
@@ -1382,12 +1385,12 @@ did_set_global_listfillchars(char_u *val, int opt_lcs, int opt_flags)
if (opt_lcs)
{
if (*wp->w_p_lcs == NUL)
- (void)set_listchars_option(wp, wp->w_p_lcs, TRUE);
+ (void)set_listchars_option(wp, wp->w_p_lcs, TRUE, NULL, 0);
}
else
{
if (*wp->w_p_fcs == NUL)
- (void)set_fillchars_option(wp, wp->w_p_fcs, TRUE);
+ (void)set_fillchars_option(wp, wp->w_p_fcs, TRUE, NULL, 0);
}
}
@@ -1408,11 +1411,13 @@ did_set_chars_option(optset_T *args)
if ( varp == &p_lcs // global 'listchars'
|| varp == &p_fcs) // global 'fillchars'
errmsg = did_set_global_listfillchars(*varp, varp == &p_lcs,
- args->os_flags);
+ args->os_flags, args->os_errbuf, args->os_errbuflen);
else if (varp == &curwin->w_p_lcs) // local 'listchars'
- errmsg = set_listchars_option(curwin, *varp, TRUE);
+ errmsg = set_listchars_option(curwin, *varp, TRUE,
+ args->os_errbuf, args->os_errbuflen);
else if (varp == &curwin->w_p_fcs) // local 'fillchars'
- errmsg = set_fillchars_option(curwin, *varp, TRUE);
+ errmsg = set_fillchars_option(curwin, *varp, TRUE,
+ args->os_errbuf, args->os_errbuflen);
return errmsg;
}