diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-05 09:50:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-05 09:50:36 +0800 |
commit | 9ded4c127599b821d0875db9d63049b5970437a4 (patch) | |
tree | 04ab960fec3aaaf6d139164e27ee8c4c6ff8f900 /src/nvim/eval/typval.c | |
parent | d79e72621226cae91c8d8f6ad23e3c0670e1211c (diff) | |
parent | bdaaf2e8e113f8c32c70f83b60e0bf3f648357c1 (diff) | |
download | rneovim-9ded4c127599b821d0875db9d63049b5970437a4.tar.gz rneovim-9ded4c127599b821d0875db9d63049b5970437a4.tar.bz2 rneovim-9ded4c127599b821d0875db9d63049b5970437a4.zip |
Merge pull request #23483 from zeertzjq/vim-8.2.3135
vim-patch:8.2.{3135,4890,4892},9.0.0250: error message improvements
Diffstat (limited to 'src/nvim/eval/typval.c')
-rw-r--r-- | src/nvim/eval/typval.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 79f514bc71..5f0c082ada 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -40,6 +40,10 @@ # include "eval/typval.c.generated.h" #endif +static const char e_variable_nested_too_deep_for_unlock[] + = N_("E743: Variable nested too deep for (un)lock"); +static const char e_using_invalid_value_as_string[] + = N_("E908: Using an invalid value as a String"); static const char e_string_required_for_argument_nr[] = N_("E1174: String required for argument %d"); static const char e_non_empty_string_required_for_argument_nr[] @@ -793,7 +797,7 @@ int tv_list_slice_or_index(list_T *list, bool range, varnumber_T n1_arg, varnumb // A list index out of range is an error. if (!range) { if (verbose) { - semsg(_(e_listidx), (int64_t)n1); + semsg(_(e_list_index_out_of_range_nr), (int64_t)n1); } return FAIL; } @@ -987,7 +991,7 @@ void tv_list_remove(typval_T *argvars, typval_T *rettv, const char *arg_errmsg) if (error) { // Type error: do nothing, errmsg already given. } else if ((item = tv_list_find(l, (int)idx)) == NULL) { - semsg(_(e_listidx), idx); + semsg(_(e_list_index_out_of_range_nr), idx); } else { if (argvars[2].v_type == VAR_UNKNOWN) { // Remove one item, return its value. @@ -1001,7 +1005,7 @@ void tv_list_remove(typval_T *argvars, typval_T *rettv, const char *arg_errmsg) if (error) { // Type error: do nothing. } else if ((item2 = tv_list_find(l, (int)end)) == NULL) { - semsg(_(e_listidx), end); + semsg(_(e_list_index_out_of_range_nr), end); } else { int cnt = 0; @@ -1575,7 +1579,7 @@ const char *tv_list_find_str(list_T *const l, const int n) { const listitem_T *const li = tv_list_find(l, n); if (li == NULL) { - semsg(_(e_listidx), (int64_t)n); + semsg(_(e_list_index_out_of_range_nr), (int64_t)n); return NULL; } return tv_get_string(TV_LIST_ITEM_TV(li)); @@ -3583,7 +3587,7 @@ void tv_item_lock(typval_T *const tv, const int deep, const bool lock, const boo static int recurse = 0; if (recurse >= DICT_MAXNEST) { - emsg(_("E743: variable nested too deep for (un)lock")); + emsg(_(e_variable_nested_too_deep_for_unlock)); return; } if (deep == 0) { @@ -3933,16 +3937,16 @@ bool tv_check_num(const typval_T *const tv) return false; } -#define FUNC_ERROR "E729: using Funcref as a String" +#define FUNC_ERROR "E729: Using a Funcref as a String" static const char *const str_errors[] = { [VAR_PARTIAL]= N_(FUNC_ERROR), [VAR_FUNC]= N_(FUNC_ERROR), - [VAR_LIST]= N_("E730: using List as a String"), - [VAR_DICT]= N_("E731: using Dictionary as a String"), - [VAR_FLOAT]= e_float_as_string, - [VAR_BLOB]= N_("E976: using Blob as a String"), - [VAR_UNKNOWN]= e_inval_string, + [VAR_LIST]= N_("E730: Using a List as a String"), + [VAR_DICT]= N_("E731: Using a Dictionary as a String"), + [VAR_FLOAT]= e_using_float_as_string, + [VAR_BLOB]= N_("E976: Using a Blob as a String"), + [VAR_UNKNOWN]= e_using_invalid_value_as_string, }; #undef FUNC_ERROR |