patch 9.1.1219: Strange error with wrong type for matchfuzzy() "camelcase"
Problem: Strange error with type for matchfuzzy() "camelcase".
Solution: Show the error "Invalid value for argument camelcase" instead
of "Invalid argument: camelcase" (zeertzjq).
Note that using tv_get_string() will lead to confusion, as when the
value cannot be converted to a string tv_get_string() will also give an
error about that, but "camelcase" takes a boolean, not a string. Also
don't use tv_get_string() for the "limit" argument above.
closes: #16926
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/search.c b/src/search.c
index c7ae4f8..2698358 100644
--- a/src/search.c
+++ b/src/search.c
@@ -5000,7 +5000,8 @@
|| di->di_tv.vval.v_string == NULL
|| *di->di_tv.vval.v_string == NUL)
{
- semsg(_(e_invalid_argument_str), tv_get_string(&di->di_tv));
+ semsg(_(e_invalid_value_for_argument_str_str), "key",
+ tv_get_string(&di->di_tv));
return;
}
key = tv_get_string(&di->di_tv);
@@ -5019,21 +5020,21 @@
{
if (di->di_tv.v_type != VAR_NUMBER)
{
- semsg(_(e_invalid_argument_str), tv_get_string(&di->di_tv));
+ semsg(_(e_invalid_value_for_argument_str), "limit");
return;
}
max_matches = (long)tv_get_number_chk(&di->di_tv, NULL);
}
if ((di = dict_find(d, (char_u *)"camelcase", -1)) != NULL)
- {
+ {
if (di->di_tv.v_type != VAR_BOOL)
{
- semsg(_(e_invalid_argument_str), "camelcase");
+ semsg(_(e_invalid_value_for_argument_str), "camelcase");
return;
}
camelcase = tv_get_bool_chk(&di->di_tv, NULL);
- }
+ }
if (dict_has_key(d, "matchseq"))
matchseq = TRUE;