Merge pull request #23483 from zeertzjq/vim-8.2.3135

vim-patch:8.2.{3135,4890,4892},9.0.0250: error message improvements
This commit is contained in:
zeertzjq 2023-05-05 09:50:36 +08:00 committed by GitHub
commit 9ded4c1275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 358 additions and 228 deletions

View File

@ -4254,7 +4254,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Warning: Setting this option can make pending mappings to be aborted
when the mouse is moved.
*'mousescroll'*
*'mousescroll'* *E5080*
'mousescroll' string (default "ver:3,hor:6")
global
This option controls the number of lines / columns to scroll by when

View File

@ -63,6 +63,8 @@ typedef struct {
# include "arglist.c.generated.h"
#endif
static const char e_window_layout_changed_unexpectedly[]
= N_("E249: Window layout changed unexpectedly");
static const char e_cannot_change_arglist_recursively[]
= N_("E1156: Cannot change the argument list recursively");
@ -976,7 +978,7 @@ static void arg_all_open_windows(arg_all_state_T *aall, int count)
aall->new_curwin = wp;
aall->new_curtab = curtab;
} else if (wp->w_frame->fr_parent != curwin->w_frame->fr_parent) {
emsg(_("E249: window layout changed unexpectedly"));
emsg(_(e_window_layout_changed_unexpectedly));
i = count;
break;
} else {

View File

@ -56,6 +56,9 @@
# include "autocmd.c.generated.h"
#endif
static const char e_autocommand_nesting_too_deep[]
= N_("E218: Autocommand nesting too deep");
// Naming Conventions:
// - general autocmd behavior start with au_
// - AutoCmd start with aucmd_
@ -1589,7 +1592,7 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
// Allow nesting of autocommands, but restrict the depth, because it's
// possible to create an endless loop.
if (nesting == 10) {
emsg(_("E218: autocommand nesting too deep"));
emsg(_(e_autocommand_nesting_too_deep));
goto BYPASS_AU;
}

View File

@ -49,7 +49,16 @@
#include "nvim/undo.h"
#include "nvim/vim.h"
static char *err_readonly = "is read-only (cannot override: \"W\" in 'cpoptions')";
static const char *err_readonly = "is read-only (cannot override: \"W\" in 'cpoptions')";
static const char e_patchmode_cant_touch_empty_original_file[]
= N_("E206: Patchmode: can't touch empty original file");
static const char e_write_error_conversion_failed_make_fenc_empty_to_override[]
= N_("E513: Write error, conversion failed (make 'fenc' empty to override)");
static const char e_write_error_conversion_failed_in_line_nr_make_fenc_empty_to_override[]
= N_("E513: Write error, conversion failed in line %" PRIdLINENR
" (make 'fenc' empty to override)");
static const char e_write_error_file_system_full[]
= N_("E514: Write error (file system full?)");
static const char e_no_matching_autocommands_for_buftype_str_buffer[]
= N_("E676: No matching autocommands for buftype=%s buffer");
@ -1064,7 +1073,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
if (buf->b_ml.ml_mfp == NULL) {
// This can happen during startup when there is a stray "w" in the
// vimrc file.
emsg(_(e_emptybuf));
emsg(_(e_empty_buffer));
return FAIL;
}
@ -1685,20 +1694,18 @@ restore_backup:
if (err.msg == NULL) {
if (write_info.bw_conv_error) {
if (write_info.bw_conv_error_lnum == 0) {
err = set_err(_("E513: write error, conversion failed "
"(make 'fenc' empty to override)"));
err = set_err(_(e_write_error_conversion_failed_make_fenc_empty_to_override));
} else {
err = set_err(xmalloc(300));
err.alloc = true;
vim_snprintf(err.msg, 300, // NOLINT(runtime/printf)
_("E513: write error, conversion failed in line %" PRIdLINENR
" (make 'fenc' empty to override)"),
_(e_write_error_conversion_failed_in_line_nr_make_fenc_empty_to_override),
write_info.bw_conv_error_lnum);
}
} else if (got_int) {
err = set_err(_(e_interr));
} else {
err = set_err(_("E514: write error (file system full?)"));
err = set_err(_(e_write_error_file_system_full));
}
}
@ -1837,7 +1844,7 @@ restore_backup:
|| (empty_fd = os_open(org,
O_CREAT | O_EXCL | O_NOFOLLOW,
perm < 0 ? 0666 : (perm & 0777))) < 0) {
emsg(_("E206: patchmode: can't touch empty original file"));
emsg(_(e_patchmode_cant_touch_empty_original_file));
} else {
close(empty_fd);
}

View File

@ -26,6 +26,8 @@
# include "cursor_shape.c.generated.h"
#endif
static const char e_digit_expected[] = N_("E548: Digit expected");
/// Handling of cursor and mouse pointer shapes in various modes.
cursorentry_T shape_table[SHAPE_IDX_COUNT] = {
// Values are set by 'guicursor' and 'mouseshape'.
@ -101,7 +103,7 @@ Array mode_style_array(Arena *arena)
/// @param what SHAPE_CURSOR or SHAPE_MOUSE ('mouseshape')
///
/// @returns error message for an illegal option, NULL otherwise.
char *parse_shape_opt(int what)
const char *parse_shape_opt(int what)
{
char *colonp;
char *commap;
@ -194,7 +196,7 @@ char *parse_shape_opt(int what)
if (len != 0) {
p += len;
if (!ascii_isdigit(*p)) {
return N_("E548: digit expected");
return e_digit_expected;
}
int n = getdigits_int(&p, false, 0);
if (len == 3) { // "ver" or "hor"

View File

@ -95,6 +95,8 @@ static const char e_cannot_index_special_variable[]
static const char *e_nowhitespace
= N_("E274: No white space allowed before parenthesis");
static const char *e_write2 = N_("E80: Error while writing: %s");
static const char e_variable_nested_too_deep_for_making_copy[]
= N_("E698: Variable nested too deep for making a copy");
static const char *e_string_list_or_blob_required = N_("E1098: String, List or Blob required");
static const char e_expression_too_recursive_str[] = N_("E1169: Expression too recursive: %s");
static const char e_dot_can_only_be_used_on_dictionary_str[]
@ -1613,7 +1615,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
if (lp->ll_li == NULL) {
tv_clear(&var2);
if (!quiet) {
semsg(_(e_listidx), (int64_t)lp->ll_n1);
semsg(_(e_list_index_out_of_range_nr), (int64_t)lp->ll_n1);
}
return NULL;
}
@ -1629,7 +1631,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
listitem_T *ni = tv_list_find(lp->ll_list, (int)lp->ll_n2);
if (ni == NULL) {
if (!quiet) {
semsg(_(e_listidx), (int64_t)lp->ll_n2);
semsg(_(e_list_index_out_of_range_nr), (int64_t)lp->ll_n2);
}
return NULL;
}
@ -1642,7 +1644,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
}
if (lp->ll_n2 < lp->ll_n1) {
if (!quiet) {
semsg(_(e_listidx), (int64_t)lp->ll_n2);
semsg(_(e_list_index_out_of_range_nr), (int64_t)lp->ll_n2);
}
return NULL;
}
@ -3567,7 +3569,7 @@ static int check_can_index(typval_T *rettv, bool evaluate, bool verbose)
return FAIL;
case VAR_FLOAT:
if (verbose) {
emsg(_(e_float_as_string));
emsg(_(e_using_float_as_string));
}
return FAIL;
case VAR_BOOL:
@ -7692,7 +7694,7 @@ int var_item_copy(const vimconv_T *const conv, typval_T *const from, typval_T *c
int ret = OK;
if (recurse >= DICT_MAXNEST) {
emsg(_("E698: variable nested too deep for making a copy"));
emsg(_(e_variable_nested_too_deep_for_making_copy));
return FAIL;
}
recurse++;

View File

@ -20,7 +20,8 @@
# include "eval/executor.c.generated.h" // IWYU pragma: export
#endif
char *e_listidx = N_("E684: list index out of range: %" PRId64);
char *e_list_index_out_of_range_nr
= N_("E684: List index out of range: %" PRId64);
/// Handle tv1 += tv2, -=, *=, /=, %=, .=
///

View File

@ -3,7 +3,7 @@
#include "nvim/eval/typval.h"
extern char *e_listidx;
extern char *e_list_index_out_of_range_nr;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "eval/executor.h.generated.h"

View File

@ -148,6 +148,8 @@ PRAGMA_DIAG_POP
static const char *e_listblobarg = N_("E899: Argument of %s must be a List or Blob");
static const char *e_invalwindow = N_("E957: Invalid window number");
static const char e_invalid_submatch_number_nr[]
= N_("E935: Invalid submatch number: %d");
static const char *e_reduceempty = N_("E998: Reduce of an empty %s with no initial value");
static const char e_missing_function_argument[]
= N_("E1132: Missing function argument");
@ -928,7 +930,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (!error) {
li = tv_list_find(l, (int)idx);
if (li == NULL) {
semsg(_(e_listidx), idx);
semsg(_(e_list_index_out_of_range_nr), idx);
}
}
}
@ -1902,7 +1904,7 @@ static void extend(typval_T *argvars, typval_T *rettv, char *arg_errmsg, bool is
} else {
item = tv_list_find(l1, (int)before);
if (item == NULL) {
semsg(_(e_listidx), (int64_t)before);
semsg(_(e_list_index_out_of_range_nr), (int64_t)before);
return;
}
}
@ -3729,7 +3731,7 @@ static void f_insert(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (before != tv_list_len(l)) {
item = tv_list_find(l, (int)before);
if (item == NULL) {
semsg(_(e_listidx), before);
semsg(_(e_list_index_out_of_range_nr), before);
l = NULL;
}
}
@ -8027,7 +8029,7 @@ static void f_submatch(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
}
if (no < 0 || no >= NSUBEXP) {
semsg(_("E935: invalid submatch number: %d"), no);
semsg(_(e_invalid_submatch_number_nr), no);
return;
}
int retList = 0;

View File

@ -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

View File

@ -52,6 +52,10 @@
static const char *e_letunexp = N_("E18: Unexpected characters in :let");
static const char *e_lock_unlock = N_("E940: Cannot lock or unlock variable %s");
static const char e_setting_str_to_value_with_wrong_type[]
= N_("E963: Setting %s to value with wrong type");
static const char e_cannot_use_heredoc_here[]
= N_("E991: Cannot use =<< here");
/// Evaluate one Vim expression {expr} in string "p" and append the
/// resulting string to "gap". "p" points to the opening "{".
@ -169,7 +173,7 @@ list_T *heredoc_get(exarg_T *eap, char *cmd, bool script_get)
char dot[] = ".";
if (eap->getline == NULL) {
emsg(_("E991: cannot use =<< here"));
emsg(_(e_cannot_use_heredoc_here));
return NULL;
}
@ -1457,7 +1461,7 @@ void set_var_const(const char *name, const size_t name_len, typval_T *const tv,
}
return;
} else if (v->di_tv.v_type != tv->v_type) {
semsg(_("E963: setting %s to value with wrong type"), name);
semsg(_(e_setting_str_to_value_with_wrong_type), name);
return;
}
}

View File

@ -126,6 +126,9 @@ typedef struct {
# include "ex_cmds.c.generated.h"
#endif
static const char e_non_numeric_argument_to_z[]
= N_("E144: Non-numeric argument to :z");
/// ":ascii" and "ga" implementation
void do_ascii(const exarg_T *const eap)
{
@ -2952,7 +2955,7 @@ void ex_z(exarg_T *eap)
if (*x != 0) {
if (!ascii_isdigit(*x)) {
emsg(_("E144: non-numeric argument to :z"));
emsg(_(e_non_numeric_argument_to_z));
return;
}
bigness = atol(x);

View File

@ -53,6 +53,9 @@
# include "ex_cmds2.c.generated.h"
#endif
static const char e_compiler_not_supported_str[]
= N_("E666: Compiler not supported: %s");
void ex_ruby(exarg_T *eap)
{
script_host_execute("ruby", eap);
@ -731,7 +734,7 @@ void ex_compiler(exarg_T *eap)
// Try lua compiler
snprintf(buf, bufsize, "compiler/%s.lua", eap->arg);
if (source_runtime(buf, DIP_ALL) == FAIL) {
semsg(_("E666: compiler not supported: %s"), eap->arg);
semsg(_(e_compiler_not_supported_str), eap->arg);
}
}
xfree(buf);

View File

@ -87,12 +87,22 @@
static const char e_ambiguous_use_of_user_defined_command[]
= N_("E464: Ambiguous use of user-defined command");
static const char e_no_call_stack_to_substitute_for_stack[]
= N_("E489: No call stack to substitute for \"<stack>\"");
static const char e_not_an_editor_command[]
= N_("E492: Not an editor command");
static const char e_no_autocommand_file_name_to_substitute_for_afile[]
= N_("E495: No autocommand file name to substitute for \"<afile>\"");
static const char e_no_autocommand_buffer_name_to_substitute_for_abuf[]
= N_("E496: No autocommand buffer number to substitute for \"<abuf>\"");
static const char e_no_autocommand_match_name_to_substitute_for_amatch[]
= N_("E497: No autocommand match name to substitute for \"<amatch>\"");
static const char e_no_source_file_name_to_substitute_for_sfile[]
= N_("E498: no :source file name to substitute for \"<sfile>\"");
static const char e_no_call_stack_to_substitute_for_stack[]
= N_("E489: no call stack to substitute for \"<stack>\"");
= N_("E498: No :source file name to substitute for \"<sfile>\"");
static const char e_no_line_number_to_use_for_slnum[]
= N_("E842: No line number to use for \"<slnum>\"");
static const char e_no_line_number_to_use_for_sflnum[]
= N_("E961: No line number to use for \"<sflnum>\"");
static const char e_no_script_file_name_to_substitute_for_script[]
= N_("E1274: No script file name to substitute for \"<script>\"");
@ -220,7 +230,7 @@ void do_exmode(void)
if ((prev_line != curwin->w_cursor.lnum
|| changedtick != buf_get_changedtick(curbuf)) && !ex_no_reprint) {
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
emsg(_(e_emptybuf));
emsg(_(e_empty_buffer));
} else {
if (ex_pressedreturn) {
// Make sure the message overwrites the right line and isn't throttled.
@ -238,7 +248,7 @@ void do_exmode(void)
}
} else if (ex_pressedreturn && !ex_no_reprint) { // must be at EOF
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
emsg(_(e_emptybuf));
emsg(_(e_empty_buffer));
} else {
emsg(_("E501: At end-of-file"));
}
@ -4900,7 +4910,7 @@ static void ex_exit(exarg_T *eap)
static void ex_print(exarg_T *eap)
{
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
emsg(_(e_emptybuf));
emsg(_(e_empty_buffer));
} else {
for (; !got_int; os_breakcheck()) {
print_line(eap->line1,
@ -6894,7 +6904,7 @@ char *eval_vars(char *src, const char *srcstart, size_t *usedlen, linenr_T *lnum
}
result = autocmd_fname;
if (result == NULL) {
*errormsg = _("E495: no autocommand file name to substitute for \"<afile>\"");
*errormsg = _(e_no_autocommand_file_name_to_substitute_for_afile);
return NULL;
}
result = path_try_shorten_fname(result);
@ -6902,7 +6912,7 @@ char *eval_vars(char *src, const char *srcstart, size_t *usedlen, linenr_T *lnum
case SPEC_ABUF: // buffer number for autocommand
if (autocmd_bufnr <= 0) {
*errormsg = _("E496: no autocommand buffer number to substitute for \"<abuf>\"");
*errormsg = _(e_no_autocommand_buffer_name_to_substitute_for_abuf);
return NULL;
}
snprintf(strbuf, sizeof(strbuf), "%d", autocmd_bufnr);
@ -6912,7 +6922,7 @@ char *eval_vars(char *src, const char *srcstart, size_t *usedlen, linenr_T *lnum
case SPEC_AMATCH: // match name for autocommand
result = autocmd_match;
if (result == NULL) {
*errormsg = _("E497: no autocommand match name to substitute for \"<amatch>\"");
*errormsg = _(e_no_autocommand_match_name_to_substitute_for_amatch);
return NULL;
}
break;
@ -6944,7 +6954,7 @@ char *eval_vars(char *src, const char *srcstart, size_t *usedlen, linenr_T *lnum
case SPEC_SLNUM: // line in file for ":so" command
if (SOURCING_NAME == NULL || SOURCING_LNUM == 0) {
*errormsg = _("E842: no line number to use for \"<slnum>\"");
*errormsg = _(e_no_line_number_to_use_for_slnum);
return NULL;
}
snprintf(strbuf, sizeof(strbuf), "%" PRIdLINENR, SOURCING_LNUM);
@ -6953,7 +6963,7 @@ char *eval_vars(char *src, const char *srcstart, size_t *usedlen, linenr_T *lnum
case SPEC_SFLNUM: // line in script file
if (current_sctx.sc_lnum + SOURCING_LNUM == 0) {
*errormsg = _("E961: no line number to use for \"<sflnum>\"");
*errormsg = _(e_no_line_number_to_use_for_sflnum);
return NULL;
}
snprintf(strbuf, sizeof(strbuf), "%" PRIdLINENR,

View File

@ -38,6 +38,9 @@
# include "ex_eval.c.generated.h"
#endif
static const char e_multiple_else[] = N_("E583: Multiple :else");
static const char e_multiple_finally[] = N_("E607: Multiple :finally");
// Exception handling terms:
//
// :try ":try" command ─┐
@ -873,7 +876,7 @@ void ex_else(exarg_T *eap)
skip = true;
} else if (cstack->cs_flags[cstack->cs_idx] & CSF_ELSE) {
if (eap->cmdidx == CMD_else) {
eap->errmsg = _("E583: multiple :else");
eap->errmsg = _(e_multiple_else);
return;
}
eap->errmsg = _("E584: :elseif after :else");
@ -1426,7 +1429,7 @@ void ex_finally(exarg_T *eap)
if (cstack->cs_flags[idx] & CSF_FINALLY) {
// Give up for a multiple ":finally" and ignore it.
eap->errmsg = _("E607: multiple :finally");
eap->errmsg = _(e_multiple_finally);
return;
}
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,

View File

@ -182,7 +182,8 @@ typedef struct ff_search_ctx_T {
# include "file_search.c.generated.h"
#endif
static const char e_pathtoolong[] = N_("E854: path too long for completion");
static const char e_path_too_long_for_completion[]
= N_("E854: Path too long for completion");
/// Initialization routine for vim_findfile().
///
@ -395,7 +396,7 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
len = 0;
while (*wc_part != NUL) {
if (len + 5 >= MAXPATHL) {
emsg(_(e_pathtoolong));
emsg(_(e_path_too_long_for_completion));
break;
}
if (strncmp(wc_part, "**", 2) == 0) {
@ -438,7 +439,7 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
// create an absolute path
if (strlen(search_ctx->ffsc_start_dir)
+ strlen(search_ctx->ffsc_fix_path) + 3 >= MAXPATHL) {
emsg(_(e_pathtoolong));
emsg(_(e_path_too_long_for_completion));
goto error_return;
}
STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir);

View File

@ -133,6 +133,8 @@ static size_t last_recorded_len = 0; // number of last recorded chars
# include "getchar.c.generated.h"
#endif
static const char e_recursive_mapping[] = N_("E223: Recursive mapping");
// Free and clear a buffer.
void free_buff(buffheader_T *buf)
{
@ -2135,7 +2137,7 @@ static int handle_mapping(int *keylenp, const bool *timedout, int *mapdepth)
// Put the replacement string in front of mapstr.
// The depth check catches ":map x y" and ":map y x".
if (++*mapdepth >= p_mmd) {
emsg(_("E223: recursive mapping"));
emsg(_(e_recursive_mapping));
if (State & MODE_CMDLINE) {
redrawcmdline();
} else {

View File

@ -968,7 +968,6 @@ EXTERN const char e_scroll[] INIT(= N_("E49: Invalid scroll size"));
EXTERN const char e_shellempty[] INIT(= N_("E91: 'shell' option is empty"));
EXTERN const char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!"));
EXTERN const char e_swapclose[] INIT(= N_("E72: Close error on swap file"));
EXTERN const char e_tagstack[] INIT(= N_("E73: tag stack empty"));
EXTERN const char e_toocompl[] INIT(= N_("E74: Command too complex"));
EXTERN const char e_longname[] INIT(= N_("E75: Name too long"));
EXTERN const char e_toomsbra[] INIT(= N_("E76: Too many ["));
@ -983,8 +982,7 @@ EXTERN const char e_write[] INIT(= N_("E80: Error while writing"));
EXTERN const char e_zerocount[] INIT(= N_("E939: Positive count required"));
EXTERN const char e_usingsid[] INIT(= N_("E81: Using <SID> not in a script context"));
EXTERN const char e_missingparen[] INIT(= N_("E107: Missing parentheses: %s"));
EXTERN const char e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'"));
EXTERN const char e_emptybuf[] INIT(= N_("E749: empty buffer"));
EXTERN const char e_empty_buffer[] INIT(= N_("E749: Empty buffer"));
EXTERN const char e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist"));
EXTERN const char e_str_not_inside_function[] INIT(= N_("E193: %s not inside a function"));
@ -1000,8 +998,7 @@ EXTERN const char e_autocmd_close[] INIT(= N_("E813: Cannot close autocmd window
EXTERN const char e_listarg[] INIT(= N_("E686: Argument of %s must be a List"));
EXTERN const char e_unsupportedoption[] INIT(= N_("E519: Option not supported"));
EXTERN const char e_fnametoolong[] INIT(= N_("E856: Filename too long"));
EXTERN const char e_float_as_string[] INIT(= N_("E806: using Float as a String"));
EXTERN const char e_inval_string[] INIT(= N_("E908: using an invalid value as a String"));
EXTERN const char e_using_float_as_string[] INIT(= N_("E806: Using a Float as a String"));
EXTERN const char e_cannot_edit_other_buf[] INIT(= N_("E788: Not allowed to edit another buffer now"));
EXTERN const char e_using_number_as_bool_nr[] INIT(= N_("E1023: Using a Number as a Bool: %d"));
EXTERN const char e_not_callable_type_str[] INIT(= N_("E1085: Not a callable type: %s"));

View File

@ -119,6 +119,17 @@ enum {
# include "highlight_group.c.generated.h"
#endif
static const char e_highlight_group_name_not_found_str[]
= N_("E411: Highlight group not found: %s");
static const char e_group_has_settings_highlight_link_ignored[]
= N_("E414: Group has settings, highlight link ignored");
static const char e_unexpected_equal_sign_str[]
= N_("E415: Unexpected equal sign: %s");
static const char e_missing_equal_sign_str_2[]
= N_("E416: Missing equal sign: %s");
static const char e_missing_argument_str[]
= N_("E417: Missing argument: %s");
#define hl_table ((HlGroup *)((highlight_ga.ga_data)))
// The default highlight groups. These are compiled-in for fast startup and
@ -920,7 +931,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (!doclear && !dolink && ends_excmd((uint8_t)(*linep))) {
int id = syn_name2id_len(line, (size_t)(name_end - line));
if (id == 0) {
semsg(_("E411: highlight group not found: %s"), line);
semsg(_(e_highlight_group_name_not_found_str), line);
} else {
highlight_list_one(id);
}
@ -976,7 +987,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (to_id > 0 && !forceit && !init
&& hl_has_settings(from_id - 1, dodefault)) {
if (SOURCING_NAME == NULL && !dodefault) {
emsg(_("E414: group has settings, highlight link ignored"));
emsg(_(e_group_has_settings_highlight_link_ignored));
}
} else if (hlgroup->sg_link != to_id
|| hlgroup->sg_script_ctx.sc_sid != current_sctx.sc_sid
@ -1054,7 +1065,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
while (!ends_excmd((uint8_t)(*linep))) {
const char *key_start = linep;
if (*linep == '=') {
semsg(_("E415: unexpected equal sign: %s"), key_start);
semsg(_(e_unexpected_equal_sign_str), key_start);
error = true;
break;
}
@ -1087,7 +1098,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
// Check for the equal sign.
if (*linep != '=') {
semsg(_("E416: missing equal sign: %s"), key_start);
semsg(_(e_missing_equal_sign_str_2), key_start);
error = true;
break;
}
@ -1108,7 +1119,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
linep = skiptowhite(linep);
}
if (linep == arg_start) {
semsg(_("E417: missing argument: %s"), key_start);
semsg(_(e_missing_argument_str), key_start);
error = true;
break;
}

View File

@ -65,6 +65,17 @@ static mapblock_T *(maphash[MAX_MAPHASH]) = { 0 };
# include "mapping.c.generated.h"
#endif
static const char e_global_abbreviation_already_exists_for_str[]
= N_("E224: Global abbreviation already exists for %s");
static const char e_global_mapping_already_exists_for_str[]
= N_("E225: Global mapping already exists for %s");
static const char e_abbreviation_already_exists_for_str[]
= N_("E226: Abbreviation already exists for %s");
static const char e_mapping_already_exists_for_str[]
= N_("E227: Mapping already exists for %s");
static const char e_entries_missing_in_mapset_dict_argument[]
= N_("E460: Entries missing in mapset() dict argument");
/// Get the start of the hashed map list for "state" and first character "c".
mapblock_T *get_maphash_list(int state, int c)
{
@ -645,10 +656,9 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
&& mp->m_keylen == len
&& strncmp(mp->m_keys, lhs, (size_t)len) == 0) {
if (is_abbrev) {
semsg(_("E224: global abbreviation already exists for %s"),
mp->m_keys);
semsg(_(e_global_abbreviation_already_exists_for_str), mp->m_keys);
} else {
semsg(_("E225: global mapping already exists for %s"), mp->m_keys);
semsg(_(e_global_mapping_already_exists_for_str), mp->m_keys);
}
retval = 5;
goto theend;
@ -761,9 +771,9 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
break;
} else if (args->unique) {
if (is_abbrev) {
semsg(_("E226: abbreviation already exists for %s"), p);
semsg(_(e_abbreviation_already_exists_for_str), p);
} else {
semsg(_("E227: mapping already exists for %s"), p);
semsg(_(e_mapping_already_exists_for_str), p);
}
retval = 5;
goto theend;
@ -2226,7 +2236,7 @@ void f_mapset(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
api_free_object(callback_obj);
}
if (lhs == NULL || lhsraw == NULL || orig_rhs == NULL) {
emsg(_("E460: entries missing in mapset() dict argument"));
emsg(_(e_entries_missing_in_mapset_dict_argument));
api_free_luaref(rhs_lua);
return;
}

View File

@ -70,6 +70,8 @@
# include "memfile.c.generated.h"
#endif
static const char e_block_was_not_locked[] = N_("E293: Block was not locked");
/// Open a new or existing memory block file.
///
/// @param fname Name of file to use.
@ -335,7 +337,7 @@ void mf_put(memfile_T *mfp, bhdr_T *hp, bool dirty, bool infile)
unsigned flags = hp->bh_flags;
if ((flags & BH_LOCKED) == 0) {
iemsg(_("E293: block was not locked"));
iemsg(_(e_block_was_not_locked));
}
flags &= ~BH_LOCKED;
if (dirty) {

View File

@ -248,7 +248,23 @@ typedef enum {
# include "memline.c.generated.h"
#endif
static char e_warning_pointer_block_corrupted[]
static const char e_ml_get_invalid_lnum_nr[]
= N_("E315: ml_get: Invalid lnum: %" PRId64);
static const char e_ml_get_cannot_find_line_nr_in_buffer_nr_str[]
= N_("E316: ml_get: Cannot find line %" PRId64 "in buffer %d %s");
static const char e_pointer_block_id_wrong[]
= N_("E317: Pointer block id wrong");
static const char e_pointer_block_id_wrong_two[]
= N_("E317: Pointer block id wrong 2");
static const char e_pointer_block_id_wrong_three[]
= N_("E317: Pointer block id wrong 3");
static const char e_pointer_block_id_wrong_four[]
= N_("E317: Pointer block id wrong 4");
static const char e_line_number_out_of_range_nr_past_the_end[]
= N_("E322: Line number out of range: %" PRId64 " past the end");
static const char e_line_count_wrong_in_block_nr[]
= N_("E323: Line count wrong in block %" PRId64);
static const char e_warning_pointer_block_corrupted[]
= N_("E1364: Warning: Pointer block corrupted");
#if __has_feature(address_sanitizer)
@ -1826,7 +1842,7 @@ char *ml_get_buf(buf_T *buf, linenr_T lnum, bool will_change)
// Avoid giving this message for a recursive call, may happen when
// the GUI redraws part of the text.
recursive++;
siemsg(_("E315: ml_get: invalid lnum: %" PRId64), (int64_t)lnum);
siemsg(_(e_ml_get_invalid_lnum_nr), (int64_t)lnum);
recursive--;
}
ml_flush_line(buf);
@ -1861,7 +1877,7 @@ errorret:
recursive++;
get_trans_bufname(buf);
shorten_dir(NameBuff);
siemsg(_("E316: ml_get: cannot find line %" PRId64 " in buffer %d %s"),
siemsg(_(e_ml_get_cannot_find_line_nr_in_buffer_nr_str),
(int64_t)lnum, buf->b_fnum, NameBuff);
recursive--;
}
@ -2228,7 +2244,7 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, boo
}
PTR_BL *pp = hp->bh_data; // must be pointer block
if (pp->pb_id != PTR_ID) {
iemsg(_("E317: pointer block id wrong 3"));
iemsg(_(e_pointer_block_id_wrong_three));
mf_put(mfp, hp, false, false);
return FAIL;
}
@ -2531,7 +2547,7 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, bool message)
}
PTR_BL *pp = hp->bh_data; // must be pointer block
if (pp->pb_id != PTR_ID) {
iemsg(_("E317: pointer block id wrong 4"));
iemsg(_(e_pointer_block_id_wrong_four));
mf_put(mfp, hp, false, false);
return FAIL;
}
@ -2897,7 +2913,7 @@ static bhdr_T *ml_find_line(buf_T *buf, linenr_T lnum, int action)
pp = (PTR_BL *)(dp); // must be pointer block
if (pp->pb_id != PTR_ID) {
iemsg(_("E317: pointer block id wrong"));
iemsg(_(e_pointer_block_id_wrong));
goto error_block;
}
@ -2935,10 +2951,10 @@ static bhdr_T *ml_find_line(buf_T *buf, linenr_T lnum, int action)
}
if (idx >= (int)pp->pb_count) { // past the end: something wrong!
if (lnum > buf->b_ml.ml_line_count) {
siemsg(_("E322: line number out of range: %" PRId64 " past the end"),
siemsg(_(e_line_number_out_of_range_nr_past_the_end),
(int64_t)lnum - buf->b_ml.ml_line_count);
} else {
siemsg(_("E323: line count wrong in block %" PRId64), bnum);
siemsg(_(e_line_count_wrong_in_block_nr), bnum);
}
goto error_block;
}
@ -3008,7 +3024,7 @@ static void ml_lineadd(buf_T *buf, int count)
PTR_BL *pp = hp->bh_data; // must be pointer block
if (pp->pb_id != PTR_ID) {
mf_put(mfp, hp, false, false);
iemsg(_("E317: pointer block id wrong 2"));
iemsg(_(e_pointer_block_id_wrong_two));
break;
}
pp->pb_pointer[ip->ip_index].pe_line_count += count;

View File

@ -106,6 +106,8 @@ static int VIsual_mode_orig = NUL; // saved Visual mode
# include "normal.c.generated.h"
#endif
static const char e_changelist_is_empty[] = N_("E664: Changelist is empty");
static inline void normal_state_init(NormalState *s)
{
memset(s, 0, sizeof(NormalState));
@ -4963,7 +4965,7 @@ static void nv_pcmark(cmdarg_T *cap)
move_res = nv_mark_move_to(cap, flags, fm);
} else if (cap->cmdchar == 'g') {
if (curbuf->b_changelistlen == 0) {
emsg(_("E664: changelist is empty"));
emsg(_(e_changelist_is_empty));
} else if (cap->count1 < 0) {
emsg(_("E662: At start of changelist"));
} else {

View File

@ -96,6 +96,9 @@ struct block_def {
# include "ops.c.generated.h"
#endif
static const char e_search_pattern_and_expression_register_may_not_contain_two_or_more_lines[]
= N_("E883: Search pattern and expression register may not contain two or more lines");
// Flags for third item in "opchars".
#define OPF_LINES 1 // operator always works on lines
#define OPF_CHANGE 2 // operator changes text
@ -5043,8 +5046,7 @@ void write_reg_contents_lst(int name, char **strings, bool must_append, MotionTy
if (strings[0] == NULL) {
s = "";
} else if (strings[1] != NULL) {
emsg(_("E883: search pattern and expression register may not "
"contain two or more lines"));
emsg(_(e_search_pattern_and_expression_register_may_not_contain_two_or_more_lines));
return;
}
write_reg_contents_ex(name, s, -1, must_append, yank_type, block_len);

View File

@ -61,8 +61,10 @@
static const char e_unclosed_expression_sequence[]
= N_("E540: Unclosed expression sequence");
static const char e_comma_required[]
= N_("E536: Comma required");
static const char e_unbalanced_groups[]
= N_("E542: unbalanced groups");
= N_("E542: Unbalanced groups");
static const char e_backupext_and_patchmode_are_equal[]
= N_("E589: 'backupext' and 'patchmode' are equal");
static const char e_showbreak_contains_unprintable_or_wide_character[]
@ -514,7 +516,7 @@ const char *did_set_mousescroll(optset_T *args FUNC_ATTR_UNUSED)
// Verify that only digits follow the colon.
for (size_t i = 4; i < length; i++) {
if (!ascii_isdigit(string[i])) {
return N_("E548: digit expected");
return N_("E5080: Digit expected");
}
}
@ -1743,7 +1745,7 @@ const char *did_set_foldmarker(optset_T *args)
char *p = vim_strchr(*varp, ',');
if (p == NULL) {
return N_("E536: comma required");
return e_comma_required;
}
if (p == *varp || p[1] == NUL) {

View File

@ -100,10 +100,20 @@ static int toggle_Magic(int x)
return (semsg((m), (c) ? "" : "\\", (a)), rc_did_emsg = true, (void *)NULL)
#define EMSG2_RET_FAIL(m, c) \
return (semsg((m), (c) ? "" : "\\"), rc_did_emsg = true, FAIL)
#define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_("E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL)
#define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_(e_invalid_item_in_str_brackets), reg_magic == MAGIC_ALL)
#define MAX_LIMIT (32767L << 16L)
static const char e_invalid_character_after_str_at[]
= N_("E59: Invalid character after %s@");
static const char e_invalid_use_of_underscore[]
= N_("E63: Invalid use of \\_");
static const char e_pattern_uses_more_memory_than_maxmempattern[]
= N_("E363: Pattern uses more memory than 'maxmempattern'");
static const char e_invalid_item_in_str_brackets[]
= N_("E369: Invalid item in %s%%[]");
static const char e_missing_delimiter_after_search_pattern_str[]
= N_("E654: Missing delimiter after search pattern: %s");
static const char e_missingbracket[] = N_("E769: Missing ] after %s[");
static const char e_reverse_range[] = N_("E944: Reverse range in character class");
static const char e_large_class[] = N_("E945: Range too large in character class");
@ -491,7 +501,7 @@ char *skip_regexp_err(char *startp, int delim, int magic)
char *p = skip_regexp(startp, delim, magic);
if (*p != delim) {
semsg(_("E654: missing delimiter after search pattern: %s"), startp);
semsg(_(e_missing_delimiter_after_search_pattern_str), startp);
return NULL;
}
return p;

View File

@ -1748,7 +1748,7 @@ static uint8_t *regatom(int *flagp)
case Magic('U'):
p = (uint8_t *)vim_strchr((char *)classchars, no_Magic(c));
if (p == NULL) {
EMSG_RET_NULL(_("E63: invalid use of \\_"));
EMSG_RET_NULL(_(e_invalid_use_of_underscore));
}
// When '.' is followed by a composing char ignore the dot, so that
// the composing char is matched here.
@ -2531,7 +2531,7 @@ static uint8_t *regpiece(int *flagp)
}
}
if (lop == END) {
EMSG2_RET_NULL(_("E59: invalid character after %s@"),
EMSG2_RET_NULL(_(e_invalid_character_after_str_at),
reg_magic == MAGIC_ALL);
}
// Look behind must match with behind_pos.
@ -3436,7 +3436,7 @@ static regitem_T *regstack_push(regstate_T state, uint8_t *scan)
regitem_T *rp;
if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
emsg(_(e_maxmempat));
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
return NULL;
}
ga_grow(&regstack, sizeof(regitem_T));
@ -4402,7 +4402,7 @@ static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
// follows. The code is below. Parameters are stored in
// a regstar_T on the regstack.
if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
emsg(_(e_maxmempat));
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
status = RA_FAIL;
} else {
ga_grow(&regstack, sizeof(regstar_T));
@ -4439,7 +4439,7 @@ static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
case NOBEHIND:
// Need a bit of room to store extra positions.
if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
emsg(_(e_maxmempat));
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
status = RA_FAIL;
} else {
ga_grow(&regstack, sizeof(regbehind_T));

View File

@ -4927,7 +4927,7 @@ skip_add:
const size_t newsize = (size_t)newlen * sizeof(nfa_thread_T);
if ((long)(newsize >> 10) >= p_mmp) {
emsg(_(e_maxmempat));
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
depth--;
return NULL;
}
@ -5218,7 +5218,7 @@ static regsubs_T *addstate_here(nfa_list_T *l, nfa_state_T *state, regsubs_T *su
const size_t newsize = (size_t)newlen * sizeof(nfa_thread_T);
if ((long)(newsize >> 10) >= p_mmp) {
emsg(_(e_maxmempat));
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
return NULL;
}
nfa_thread_T *const newl = xmalloc(newsize);

View File

@ -59,6 +59,11 @@
# include "search.c.generated.h"
#endif
static const char e_search_hit_top_without_match_for_str[]
= N_("E384: Search hit TOP without match for: %s");
static const char e_search_hit_bottom_without_match_for_str[]
= N_("E385: Search hit BOTTOM without match for: %s");
// This file contains various searching-related routines. These fall into
// three groups:
// 1. string searches (for /, ?, n, and N)
@ -943,11 +948,9 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
if (p_ws) {
semsg(_(e_patnotf2), mr_pattern);
} else if (lnum == 0) {
semsg(_("E384: search hit TOP without match for: %s"),
mr_pattern);
semsg(_(e_search_hit_top_without_match_for_str), mr_pattern);
} else {
semsg(_("E385: search hit BOTTOM without match for: %s"),
mr_pattern);
semsg(_(e_search_hit_bottom_without_match_for_str), mr_pattern);
}
}
return FAIL;

View File

@ -323,6 +323,10 @@ enum {
};
static const char *e_spell_trunc = N_("E758: Truncated spell file");
static const char e_error_while_reading_sug_file_str[]
= N_("E782: Error while reading .sug file: %s");
static const char e_duplicate_char_in_map_entry[]
= N_("E783: Duplicate char in MAP entry");
static const char *e_illegal_character_in_word = N_("E1280: Illegal character in word");
static const char *e_afftrailing = N_("Trailing text in %s line %d: %s");
static const char *e_affname = N_("Affix name too long in %s line %d: %s");
@ -956,7 +960,7 @@ void suggest_load_files(void)
if (spell_read_tree(fd, &slang->sl_sbyts, NULL, &slang->sl_sidxs,
false, 0) != 0) {
someerror:
semsg(_("E782: error while reading .sug file: %s"),
semsg(_(e_error_while_reading_sug_file_str),
slang->sl_fname);
slang_clear_sug(slang);
goto nextone;
@ -5860,7 +5864,7 @@ static void set_map_str(slang_T *lp, char *map)
} else {
// This should have been checked when generating the .spl
// file.
emsg(_("E783: duplicate char in MAP entry"));
emsg(_(e_duplicate_char_in_map_entry));
xfree(b);
}
} else {

View File

@ -59,6 +59,12 @@ static bool did_syntax_onoff = false;
#define SPO_COUNT 7
static const char e_illegal_arg[] = N_("E390: Illegal argument: %s");
static const char e_contains_argument_not_accepted_here[]
= N_("E395: Contains argument not accepted here");
static const char e_invalid_cchar_value[]
= N_("E844: Invalid cchar value");
static const char e_trailing_char_after_rsb_str_str[]
= N_("E890: Trailing char after ']': %s]%s");
// The patterns that are being searched for are stored in a syn_pattern.
// A match item consists of one pattern.
@ -3874,7 +3880,7 @@ static char *get_syn_options(char *arg, syn_opt_arg_T *opt, int *conceal_char, i
if (flagtab[fidx].argtype == 1) {
if (!opt->has_cont_list) {
emsg(_("E395: contains argument not accepted here"));
emsg(_(e_contains_argument_not_accepted_here));
return NULL;
}
if (get_id_list(&arg, 8, &opt->cont_list, skip) == FAIL) {
@ -3893,7 +3899,7 @@ static char *get_syn_options(char *arg, syn_opt_arg_T *opt, int *conceal_char, i
*conceal_char = utf_ptr2char(arg + 6);
arg += utfc_ptr2len(arg + 6) - 1;
if (!vim_isprintc_strict(*conceal_char)) {
emsg(_("E844: invalid cchar value"));
emsg(_(e_invalid_cchar_value));
return NULL;
}
arg = skipwhite(arg + 7);
@ -4111,8 +4117,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
}
if (p[1] == ']') {
if (p[2] != NUL) {
semsg(_("E890: trailing char after ']': %s]%s"),
kw, &p[2]);
semsg(_(e_trailing_char_after_rsb_str_str), kw, &p[2]);
goto error;
}
kw = p + 1;

View File

@ -188,10 +188,18 @@ typedef struct {
# include "tag.c.generated.h"
#endif
static const char *bottommsg = N_("E555: at bottom of tag stack");
static const char *topmsg = N_("E556: at top of tag stack");
static const char *recurmsg = N_("E986: cannot modify the tag stack within tagfunc");
static const char *tfu_inv_ret_msg = N_("E987: invalid return value from tagfunc");
static const char e_tag_stack_empty[]
= N_("E73: Tag stack empty");
static const char e_tag_not_found_str[]
= N_("E426: Tag not found: %s");
static const char e_at_bottom_of_tag_stack[]
= N_("E555: At bottom of tag stack");
static const char e_at_top_of_tag_stack[]
= N_("E556: At top of tag stack");
static const char e_cannot_modify_tag_stack_within_tagfunc[]
= N_("E986: Cannot modify the tag stack within tagfunc");
static const char e_invalid_return_value_from_tagfunc[]
= N_("E987: Invalid return value from tagfunc");
static const char e_window_unexpectedly_close_while_searching_for_tags[]
= N_("E1299: Window unexpectedly closed while searching for tags");
@ -304,7 +312,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
static int flags;
if (tfu_in_use) {
emsg(_(recurmsg));
emsg(_(e_cannot_modify_tag_stack_within_tagfunc));
return;
}
@ -391,14 +399,14 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
if (g_do_tagpreview != 0 ? ptag_entry.tagname == NULL :
tagstacklen == 0) {
// empty stack
emsg(_(e_tagstack));
emsg(_(e_tag_stack_empty));
goto end_do_tag;
}
if (type == DT_POP) { // go to older position
const bool old_KeyTyped = KeyTyped;
if ((tagstackidx -= count) < 0) {
emsg(_(bottommsg));
emsg(_(e_at_bottom_of_tag_stack));
if (tagstackidx + count == 0) {
// We did [num]^T from the bottom of the stack
tagstackidx = 0;
@ -408,7 +416,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
// way to the bottom now.
tagstackidx = 0;
} else if (tagstackidx >= tagstacklen) { // count == 0?
emsg(_(topmsg));
emsg(_(e_at_top_of_tag_stack));
goto end_do_tag;
}
@ -457,10 +465,10 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
// go to the last one. Don't store the cursor
// position.
tagstackidx = tagstacklen - 1;
emsg(_(topmsg));
emsg(_(e_at_top_of_tag_stack));
save_pos = false;
} else if (tagstackidx < 0) { // must have been count == 0
emsg(_(bottommsg));
emsg(_(e_at_bottom_of_tag_stack));
tagstackidx = 0;
goto end_do_tag;
}
@ -638,7 +646,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
if (num_matches <= 0) {
if (verbose) {
semsg(_("E426: tag not found: %s"), name);
semsg(_(e_tag_not_found_str), name);
}
g_do_tagpreview = 0;
} else {
@ -1281,7 +1289,7 @@ static int find_tagfunc_tags(char *pat, garray_T *ga, int *match_count, int flag
}
if (rettv.v_type != VAR_LIST || !rettv.vval.v_list) {
tv_clear(&rettv);
emsg(_(tfu_inv_ret_msg));
emsg(_(e_invalid_return_value_from_tagfunc));
return FAIL;
}
taglist = rettv.vval.v_list;
@ -1295,7 +1303,7 @@ static int find_tagfunc_tags(char *pat, garray_T *ga, int *match_count, int flag
int name_only = flags & TAG_NAMES;
if (TV_LIST_ITEM_TV(li)->v_type != VAR_DICT) {
emsg(_(tfu_inv_ret_msg));
emsg(_(e_invalid_return_value_from_tagfunc));
break;
}
@ -1341,7 +1349,7 @@ static int find_tagfunc_tags(char *pat, garray_T *ga, int *match_count, int flag
}
if (!res_name || !res_fname || !res_cmd) {
emsg(_(tfu_inv_ret_msg));
emsg(_(e_invalid_return_value_from_tagfunc));
break;
}
@ -3560,7 +3568,7 @@ int set_tagstack(win_T *wp, const dict_T *d, int action)
// not allowed to alter the tag stack entries from inside tagfunc
if (tfu_in_use) {
emsg(_(recurmsg));
emsg(_(e_cannot_modify_tag_stack_within_tagfunc));
return FAIL;
}

View File

@ -137,6 +137,13 @@ typedef struct {
# include "undo.c.generated.h"
#endif
static const char e_undo_list_corrupt[]
= N_("E439: Undo list corrupt");
static const char e_undo_line_missing[]
= N_("E440: Undo line missing");
static const char e_write_error_in_undo_file_str[]
= N_("E829: Write error in undo file: %s");
// used in undo_end() to report number of added and deleted lines
static long u_newcount, u_oldcount;
@ -1340,7 +1347,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
write_error:
fclose(fp);
if (!write_ok) {
semsg(_("E829: write error in undo file: %s"), file_name);
semsg(_(e_write_error_in_undo_file_str), file_name);
}
if (buf->b_ffname != NULL) {
@ -2809,7 +2816,7 @@ static void u_unch_branch(u_header_T *uhp)
static u_entry_T *u_get_headentry(buf_T *buf)
{
if (buf->b_u_newhead == NULL || buf->b_u_newhead->uh_entry == NULL) {
iemsg(_("E439: undo list corrupt"));
iemsg(_(e_undo_list_corrupt));
return NULL;
}
return buf->b_u_newhead->uh_entry;
@ -2832,7 +2839,7 @@ static void u_getbot(buf_T *buf)
linenr_T extra = buf->b_ml.ml_line_count - uep->ue_lcount;
uep->ue_bot = uep->ue_top + (linenr_T)uep->ue_size + 1 + extra;
if (uep->ue_bot < 1 || uep->ue_bot > buf->b_ml.ml_line_count) {
iemsg(_("E440: undo line missing"));
iemsg(_(e_undo_line_missing));
uep->ue_bot = uep->ue_top + 1; // assume all lines deleted, will
// get all the old lines back
// without deleting the current

View File

@ -44,10 +44,12 @@
garray_T ucmds = { 0, 0, sizeof(ucmd_T), 4, NULL };
static const char e_complete_used_without_allowing_arguments[]
= N_("E1208: -complete used without allowing arguments");
static const char e_argument_required_for_str[]
= N_("E179: Argument required for %s");
static const char e_no_such_user_defined_command_str[]
= N_("E184: No such user-defined command: %s");
static const char e_complete_used_without_allowing_arguments[]
= N_("E1208: -complete used without allowing arguments");
static const char e_no_such_user_defined_command_in_current_buffer_str[]
= N_("E1237: No such user-defined command in current buffer: %s");
@ -808,7 +810,7 @@ invalid_count:
}
} else if (STRNICMP(attr, "complete", attrlen) == 0) {
if (val == NULL) {
emsg(_("E179: argument required for -complete"));
semsg(_(e_argument_required_for_str), "-complete");
return FAIL;
}
@ -819,7 +821,7 @@ invalid_count:
} else if (STRNICMP(attr, "addr", attrlen) == 0) {
*argt |= EX_RANGE;
if (val == NULL) {
emsg(_("E179: argument required for -addr"));
semsg(_(e_argument_required_for_str), "-addr");
return FAIL;
}
if (parse_addr_type_arg(val, (int)vallen, addr_type_arg) == FAIL) {

View File

@ -86,7 +86,7 @@ describe('insert-mode', function()
{0:~ }|
{4: }|
={2:{}} |
{5:E731: using Dictionary as a String} |
{5:E731: Using a Dictionary as a String} |
{6:Press ENTER or type command to continue}^ |
]])
feed('<CR>')

View File

@ -24,7 +24,7 @@ describe(':highlight', function()
end)
it('invalid group name', function()
eq('Vim(highlight):E411: highlight group not found: foo',
eq('Vim(highlight):E411: Highlight group not found: foo',
exc_exec("highlight foo"))
end)

View File

@ -95,7 +95,7 @@ describe('edit', function()
{0:~ }|
{4: }|
={2:{}} |
{5:E731: using Dictionary as a String} |
{5:E731: Using a Dictionary as a String} |
{6:Press ENTER or type command to continue}^ |
]])

View File

@ -613,15 +613,15 @@ describe('eval', function()
Executing call setreg(1, 2, 3, 4)
Vim(call):E118: Too many arguments for function: setreg
Executing call setreg([], 2)
Vim(call):E730: using List as a String
Vim(call):E730: Using a List as a String
Executing call setreg(1, 2, [])
Vim(call):E730: using List as a String
Vim(call):E730: Using a List as a String
Executing call setreg("/", ["1", "2"])
Vim(call):E883: search pattern and expression register may not contain two or more lines
Vim(call):E883: Search pattern and expression register may not contain two or more lines
Executing call setreg("=", ["1", "2"])
Vim(call):E883: search pattern and expression register may not contain two or more lines
Vim(call):E883: Search pattern and expression register may not contain two or more lines
Executing call setreg(1, ["", "", [], ""])
Vim(call):E730: using List as a String]])
Vim(call):E730: Using a List as a String]])
end)
it('function name not starting with a capital', function()

View File

@ -8,7 +8,7 @@ describe('glob2regpat()', function()
before_each(clear)
it('handles invalid input', function()
eq('Vim(call):E806: using Float as a String',
eq('Vim(call):E806: Using a Float as a String',
exc_exec('call glob2regpat(1.33)'))
end)
it('returns ^$ for empty input', function()

View File

@ -198,7 +198,7 @@ describe(':luado command', function()
end)
it('works correctly when changing lines out of range', function()
curbufmeths.set_lines(0, 1, false, {"ABC", "def", "gHi"})
eq('Vim(luado):E322: line number out of range: 1 past the end',
eq('Vim(luado):E322: Line number out of range: 1 past the end',
pcall_err(command, '2,$luado vim.api.nvim_command("%d") return linenr'))
eq({''}, curbufmeths.get_lines(0, -1, false))
end)

View File

@ -892,8 +892,8 @@ describe('stdpath()', function()
end)
it('on non-strings', function()
eq('Vim(call):E731: using Dictionary as a String', exc_exec('call stdpath({"eris": 23})'))
eq('Vim(call):E730: using List as a String', exc_exec('call stdpath([23])'))
eq('Vim(call):E731: Using a Dictionary as a String', exc_exec('call stdpath({"eris": 23})'))
eq('Vim(call):E730: Using a List as a String', exc_exec('call stdpath([23])'))
end)
end)
end)

View File

@ -20,7 +20,7 @@ end
describe("'mousescroll'", function()
local invalid_arg = 'Vim(set):E474: Invalid argument: mousescroll='
local digit_expected = 'Vim(set):E548: digit expected: mousescroll='
local digit_expected = 'Vim(set):E5080: Digit expected: mousescroll='
local function should_fail(val, errorstr)
eq(errorstr..val, exc_exec('set mousescroll='..val))

View File

@ -854,11 +854,11 @@ describe('Ex commands coloring', function()
:# |
{ERR:Error detected while processing :} |
{ERR:E605: Exception not caught: 42} |
{ERR:E749: empty buffer} |
{ERR:E749: Empty buffer} |
{PE:Press ENTER or type command to continue}^ |
]])
feed('<CR>')
eq('Error detected while processing :\nE605: Exception not caught: 42\nE749: empty buffer',
eq('Error detected while processing :\nE605: Exception not caught: 42\nE749: Empty buffer',
exec_capture('messages'))
end)
it('errors out when failing to get callback', function()

View File

@ -790,7 +790,7 @@ describe('ui/mouse/input', function()
feed('<C-LeftMouse><0,0>')
screen:expect([[
{6:E433: No tags file} |
{6:E426: tag not found: test}|
{6:E426: Tag not found: test}|
{6:ing} |
{7:Press ENTER or type comma}|
{7:nd to continue}^ |

View File

@ -93,17 +93,17 @@ describe('execute()', function()
it('captures errors', function()
local ret
ret = exc_exec('call execute(0.0)')
eq('Vim(call):E806: using Float as a String', ret)
eq('Vim(call):E806: Using a Float as a String', ret)
ret = exc_exec('call execute(v:_null_dict)')
eq('Vim(call):E731: using Dictionary as a String', ret)
eq('Vim(call):E731: Using a Dictionary as a String', ret)
ret = exc_exec('call execute(function("tr"))')
eq('Vim(call):E729: using Funcref as a String', ret)
eq('Vim(call):E729: Using a Funcref as a String', ret)
ret = exc_exec('call execute(["echo 42", 0.0, "echo 44"])')
eq('Vim:E806: using Float as a String', ret)
eq('Vim:E806: Using a Float as a String', ret)
ret = exc_exec('call execute(["echo 42", v:_null_dict, "echo 44"])')
eq('Vim:E731: using Dictionary as a String', ret)
eq('Vim:E731: Using a Dictionary as a String', ret)
ret = exc_exec('call execute(["echo 42", function("tr"), "echo 44"])')
eq('Vim:E729: using Funcref as a String', ret)
eq('Vim:E729: Using a Funcref as a String', ret)
end)
it('captures output with highlights', function()
@ -322,10 +322,10 @@ describe('execute()', function()
it('propagates errors for "" and "silent"', function()
local ret
ret = exc_exec('call execute(0.0, "")')
eq('Vim(call):E806: using Float as a String', ret)
eq('Vim(call):E806: Using a Float as a String', ret)
ret = exc_exec('call execute(v:_null_dict, "silent")')
eq('Vim(call):E731: using Dictionary as a String', ret)
eq('Vim(call):E731: Using a Dictionary as a String', ret)
ret = exc_exec('call execute("echo add(1, 1)", "")')
eq('Vim(echo):E897: List or Blob required', ret)

View File

@ -222,17 +222,17 @@ describe('input()', function()
eq('DEF2', meths.get_var('var'))
end)
it('errors out on invalid inputs', function()
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call input([])'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call input("", [])'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call input("", "", [])'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call input({"prompt": []})'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call input({"default": []})'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call input({"completion": []})'))
eq('Vim(call):E5050: {opts} must be the only argument',
exc_exec('call input({}, "default")'))
@ -418,17 +418,17 @@ describe('inputdialog()', function()
eq('DEF2', meths.get_var('var'))
end)
it('errors out on invalid inputs', function()
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call inputdialog([])'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call inputdialog("", [])'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call inputdialog("", "", [])'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call inputdialog({"prompt": []})'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call inputdialog({"default": []})'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
exc_exec('call inputdialog({"completion": []})'))
eq('Vim(call):E5050: {opts} must be the only argument',
exc_exec('call inputdialog({}, "default")'))
@ -512,13 +512,13 @@ describe('confirm()', function()
eq(1, meths.get_var('a'))
end
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
pcall_err(command, 'call confirm([])'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
pcall_err(command, 'call confirm("Are you sure?", [])'))
eq('Vim(call):E745: Using a List as a Number',
pcall_err(command, 'call confirm("Are you sure?", "&Yes\n&No\n", [])'))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
pcall_err(command, 'call confirm("Are you sure?", "&Yes\n&No\n", 0, [])'))
end)

View File

@ -246,9 +246,9 @@ describe('mapset()', function()
end)
it('does not leak memory if lhs is missing', function()
eq('Vim:E460: entries missing in mapset() dict argument',
eq('Vim:E460: Entries missing in mapset() dict argument',
pcall_err(exec_lua, [[vim.fn.mapset('n', false, {rhs = 'foo'})]]))
eq('Vim:E460: entries missing in mapset() dict argument',
eq('Vim:E460: Entries missing in mapset() dict argument',
pcall_err(exec_lua, [[vim.fn.mapset('n', false, {callback = function() end})]]))
end)
end)

View File

@ -65,7 +65,7 @@ describe('NULL', function()
-- Correct behaviour
null_expr_test('can be indexed with error message for empty list', 'L[0]',
'E684: list index out of range: 0', nil)
'E684: List index out of range: 0', nil)
null_expr_test('can be splice-indexed', 'L[:]', 0, {})
null_expr_test('is not locked', 'islocked("v:_null_list")', 0, 0)
null_test('is accepted by :for', 'for x in L|throw x|endfor', 0)
@ -80,7 +80,7 @@ describe('NULL', function()
null_expr_test('can be copied', 'copy(L)', 0, {})
null_expr_test('can be deepcopied', 'deepcopy(L)', 0, {})
null_expr_test('does not crash when indexed', 'L[1]',
'E684: list index out of range: 1', nil)
'E684: List index out of range: 1', nil)
null_expr_test('does not crash call()', 'call("arglistid", L)', 0, 0)
null_expr_test('does not crash col()', 'col(L)', 0, 0)
null_expr_test('does not crash virtcol()', 'virtcol(L)', 0, 0)

View File

@ -145,13 +145,13 @@ describe('writefile()', function()
pcall_err(command, ('call writefile(%s, "%s", "b")'):format(arg, fname)))
end
for _, args in ipairs({'[], %s, "b"', '[], "' .. fname .. '", %s'}) do
eq('Vim(call):E806: using Float as a String',
eq('Vim(call):E806: Using a Float as a String',
pcall_err(command, ('call writefile(%s)'):format(args:format('0.0'))))
eq('Vim(call):E730: using List as a String',
eq('Vim(call):E730: Using a List as a String',
pcall_err(command, ('call writefile(%s)'):format(args:format('[]'))))
eq('Vim(call):E731: using Dictionary as a String',
eq('Vim(call):E731: Using a Dictionary as a String',
pcall_err(command, ('call writefile(%s)'):format(args:format('{}'))))
eq('Vim(call):E729: using Funcref as a String',
eq('Vim(call):E729: Using a Funcref as a String',
pcall_err(command, ('call writefile(%s)'):format(args:format('function("tr")'))))
end
eq('Vim(call):E5060: Unknown flag: «»',

View File

@ -141,7 +141,7 @@ func Test_source_sfile()
if RunVim([], [], '--clean -s Xscript')
call assert_equal([
\ 'E1274: No script file name to substitute for "<script>"',
\ 'E498: no :source file name to substitute for "<sfile>"'],
\ 'E498: No :source file name to substitute for "<sfile>"'],
\ readfile('Xresult'))
endif
call delete('Xscript')

View File

@ -377,9 +377,9 @@ func Test_searchpairpos()
endfunc
func Test_searchpair_errors()
call assert_fails("call searchpair([0], 'middle', 'end', 'bW', 'skip', 99, 100)", 'E730: using List as a String')
call assert_fails("call searchpair('start', {-> 0}, 'end', 'bW', 'skip', 99, 100)", 'E729: using Funcref as a String')
call assert_fails("call searchpair('start', 'middle', {'one': 1}, 'bW', 'skip', 99, 100)", 'E731: using Dictionary as a String')
call assert_fails("call searchpair([0], 'middle', 'end', 'bW', 'skip', 99, 100)", 'E730: Using a List as a String')
call assert_fails("call searchpair('start', {-> 0}, 'end', 'bW', 'skip', 99, 100)", 'E729: Using a Funcref as a String')
call assert_fails("call searchpair('start', 'middle', {'one': 1}, 'bW', 'skip', 99, 100)", 'E731: Using a Dictionary as a String')
call assert_fails("call searchpair('start', 'middle', 'end', 'flags', 'skip', 99, 100)", 'E475: Invalid argument: flags')
call assert_fails("call searchpair('start', 'middle', 'end', 'bW', 'func', -99, 100)", 'E475: Invalid argument: -99')
call assert_fails("call searchpair('start', 'middle', 'end', 'bW', 'func', 99, -100)", 'E475: Invalid argument: -100')
@ -388,9 +388,9 @@ func Test_searchpair_errors()
endfunc
func Test_searchpairpos_errors()
call assert_fails("call searchpairpos([0], 'middle', 'end', 'bW', 'skip', 99, 100)", 'E730: using List as a String')
call assert_fails("call searchpairpos('start', {-> 0}, 'end', 'bW', 'skip', 99, 100)", 'E729: using Funcref as a String')
call assert_fails("call searchpairpos('start', 'middle', {'one': 1}, 'bW', 'skip', 99, 100)", 'E731: using Dictionary as a String')
call assert_fails("call searchpairpos([0], 'middle', 'end', 'bW', 'skip', 99, 100)", 'E730: Using a List as a String')
call assert_fails("call searchpairpos('start', {-> 0}, 'end', 'bW', 'skip', 99, 100)", 'E729: Using a Funcref as a String')
call assert_fails("call searchpairpos('start', 'middle', {'one': 1}, 'bW', 'skip', 99, 100)", 'E731: Using a Dictionary as a String')
call assert_fails("call searchpairpos('start', 'middle', 'end', 'flags', 'skip', 99, 100)", 'E475: Invalid argument: flags')
call assert_fails("call searchpairpos('start', 'middle', 'end', 'bW', 'func', -99, 100)", 'E475: Invalid argument: -99')
call assert_fails("call searchpairpos('start', 'middle', 'end', 'bW', 'func', 99, -100)", 'E475: Invalid argument: -100')

View File

@ -3087,7 +3087,7 @@ func Test_nested_if_else_errors()
endif
END
call writefile(code, 'Xtest')
call AssertException(['source Xtest'], 'Vim(else):E583: multiple :else')
call AssertException(['source Xtest'], 'Vim(else):E583: Multiple :else')
" :elseif after :else
let code =<< trim END

View File

@ -1461,18 +1461,18 @@ describe('typval.c', function()
itp('fails with error message when index is out of range', function()
local l = list(int(1), int(2), int(3), int(4), int(5))
eq(nil, tv_list_find_str(l, -6, 'E684: list index out of range: -6'))
eq(nil, tv_list_find_str(l, 5, 'E684: list index out of range: 5'))
eq(nil, tv_list_find_str(l, -6, 'E684: List index out of range: -6'))
eq(nil, tv_list_find_str(l, 5, 'E684: List index out of range: 5'))
end)
itp('fails with error message on invalid types', function()
local l = list(1, empty_list, {})
eq('', tv_list_find_str(l, 0, 'E806: using Float as a String'))
eq('', tv_list_find_str(l, 1, 'E730: using List as a String'))
eq('', tv_list_find_str(l, 2, 'E731: using Dictionary as a String'))
eq('', tv_list_find_str(l, -1, 'E731: using Dictionary as a String'))
eq('', tv_list_find_str(l, -2, 'E730: using List as a String'))
eq('', tv_list_find_str(l, -3, 'E806: using Float as a String'))
eq('', tv_list_find_str(l, 0, 'E806: Using a Float as a String'))
eq('', tv_list_find_str(l, 1, 'E730: Using a List as a String'))
eq('', tv_list_find_str(l, 2, 'E731: Using a Dictionary as a String'))
eq('', tv_list_find_str(l, -1, 'E731: Using a Dictionary as a String'))
eq('', tv_list_find_str(l, -2, 'E730: Using a List as a String'))
eq('', tv_list_find_str(l, -3, 'E806: Using a Float as a String'))
end)
end)
end)
@ -1745,7 +1745,7 @@ describe('typval.c', function()
itp('works', function()
local d = ffi.gc(dict({test={}}), nil)
eq('', ffi.string(check_emsg(function() return lib.tv_dict_get_string(d, 'test', false) end,
'E731: using Dictionary as a String')))
'E731: Using a Dictionary as a String')))
d = ffi.gc(dict({tes=int(42), t=44, te='43', xx=int(45)}), nil)
alloc_log:clear()
local dis = dict_items(d)
@ -1766,7 +1766,7 @@ describe('typval.c', function()
eq(s43, dis.te.di_tv.vval.v_string)
alloc_log:check({})
eq('', ffi.string(check_emsg(function() return lib.tv_dict_get_string(d, 't', false) end,
'E806: using Float as a String')))
'E806: Using a Float as a String')))
end)
itp('allocates a string copy when requested', function()
local function tv_dict_get_string_alloc(d, key, emsg)
@ -1785,14 +1785,14 @@ describe('typval.c', function()
return s_ret
end
local d = ffi.gc(dict({test={}}), nil)
eq('', tv_dict_get_string_alloc(d, 'test', 'E731: using Dictionary as a String'))
eq('', tv_dict_get_string_alloc(d, 'test', 'E731: Using a Dictionary as a String'))
d = ffi.gc(dict({tes=int(42), t=44, te='43', xx=int(45)}), nil)
alloc_log:clear()
eq(nil, tv_dict_get_string_alloc(d, 'test'))
eq('42', tv_dict_get_string_alloc(d, 'tes'))
eq('45', tv_dict_get_string_alloc(d, 'xx'))
eq('43', tv_dict_get_string_alloc(d, 'te'))
eq('', tv_dict_get_string_alloc(d, 't', 'E806: using Float as a String'))
eq('', tv_dict_get_string_alloc(d, 't', 'E806: Using a Float as a String'))
end)
end)
describe('get_string_buf()', function()
@ -1827,7 +1827,7 @@ describe('typval.c', function()
s, r, b = tv_dict_get_string_buf(d, 'test')
neq(r, b)
eq('tset', s)
s, r, b = tv_dict_get_string_buf(d, 't', nil, 'E806: using Float as a String')
s, r, b = tv_dict_get_string_buf(d, 't', nil, 'E806: Using a Float as a String')
neq(r, b)
eq('', s)
s, r, b = tv_dict_get_string_buf(d, 'te')
@ -1870,7 +1870,7 @@ describe('typval.c', function()
neq(r, b)
neq(r, def)
eq('tset', s)
s, r, b, def = tv_dict_get_string_buf_chk(d, 'test', 1, nil, nil, 'E806: using Float as a String')
s, r, b, def = tv_dict_get_string_buf_chk(d, 'test', 1, nil, nil, 'E806: Using a Float as a String')
neq(r, b)
neq(r, def)
eq(nil, s)
@ -2831,14 +2831,14 @@ describe('typval.c', function()
alloc_log:clear()
for _, v in ipairs({
{lib.VAR_NUMBER, nil},
{lib.VAR_FLOAT, 'E806: using Float as a String'},
{lib.VAR_PARTIAL, 'E729: using Funcref as a String'},
{lib.VAR_FUNC, 'E729: using Funcref as a String'},
{lib.VAR_LIST, 'E730: using List as a String'},
{lib.VAR_DICT, 'E731: using Dictionary as a String'},
{lib.VAR_FLOAT, 'E806: Using a Float as a String'},
{lib.VAR_PARTIAL, 'E729: Using a Funcref as a String'},
{lib.VAR_FUNC, 'E729: Using a Funcref as a String'},
{lib.VAR_LIST, 'E730: Using a List as a String'},
{lib.VAR_DICT, 'E731: Using a Dictionary as a String'},
{lib.VAR_BOOL, nil},
{lib.VAR_SPECIAL, nil},
{lib.VAR_UNKNOWN, 'E908: using an invalid value as a String'},
{lib.VAR_UNKNOWN, 'E908: Using an invalid value as a String'},
}) do
local typ = v[1]
local emsg = v[2]
@ -2986,15 +2986,15 @@ describe('typval.c', function()
for _, v in ipairs({
{lib.VAR_NUMBER, {v_number=42}, nil, '42'},
{lib.VAR_STRING, {v_string=to_cstr('100500')}, nil, '100500'},
{lib.VAR_FLOAT, {v_float=42.53}, 'E806: using Float as a String', ''},
{lib.VAR_PARTIAL, {v_partial=NULL}, 'E729: using Funcref as a String', ''},
{lib.VAR_FUNC, {v_string=NULL}, 'E729: using Funcref as a String', ''},
{lib.VAR_LIST, {v_list=NULL}, 'E730: using List as a String', ''},
{lib.VAR_DICT, {v_dict=NULL}, 'E731: using Dictionary as a String', ''},
{lib.VAR_FLOAT, {v_float=42.53}, 'E806: Using a Float as a String', ''},
{lib.VAR_PARTIAL, {v_partial=NULL}, 'E729: Using a Funcref as a String', ''},
{lib.VAR_FUNC, {v_string=NULL}, 'E729: Using a Funcref as a String', ''},
{lib.VAR_LIST, {v_list=NULL}, 'E730: Using a List as a String', ''},
{lib.VAR_DICT, {v_dict=NULL}, 'E731: Using a Dictionary as a String', ''},
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarNull}, nil, 'v:null'},
{lib.VAR_BOOL, {v_bool=lib.kBoolVarTrue}, nil, 'v:true'},
{lib.VAR_BOOL, {v_bool=lib.kBoolVarFalse}, nil, 'v:false'},
{lib.VAR_UNKNOWN, nil, 'E908: using an invalid value as a String', ''},
{lib.VAR_UNKNOWN, nil, 'E908: Using an invalid value as a String', ''},
}) do
-- Using to_cstr in place of Neovim allocated string, cannot
-- tv_clear() that.
@ -3030,15 +3030,15 @@ describe('typval.c', function()
for _, v in ipairs({
{lib.VAR_NUMBER, {v_number=42}, nil, '42'},
{lib.VAR_STRING, {v_string=to_cstr('100500')}, nil, '100500'},
{lib.VAR_FLOAT, {v_float=42.53}, 'E806: using Float as a String', nil},
{lib.VAR_PARTIAL, {v_partial=NULL}, 'E729: using Funcref as a String', nil},
{lib.VAR_FUNC, {v_string=NULL}, 'E729: using Funcref as a String', nil},
{lib.VAR_LIST, {v_list=NULL}, 'E730: using List as a String', nil},
{lib.VAR_DICT, {v_dict=NULL}, 'E731: using Dictionary as a String', nil},
{lib.VAR_FLOAT, {v_float=42.53}, 'E806: Using a Float as a String', nil},
{lib.VAR_PARTIAL, {v_partial=NULL}, 'E729: Using a Funcref as a String', nil},
{lib.VAR_FUNC, {v_string=NULL}, 'E729: Using a Funcref as a String', nil},
{lib.VAR_LIST, {v_list=NULL}, 'E730: Using a List as a String', nil},
{lib.VAR_DICT, {v_dict=NULL}, 'E731: Using a Dictionary as a String', nil},
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarNull}, nil, 'v:null'},
{lib.VAR_BOOL, {v_bool=lib.kBoolVarTrue}, nil, 'v:true'},
{lib.VAR_BOOL, {v_bool=lib.kBoolVarFalse}, nil, 'v:false'},
{lib.VAR_UNKNOWN, nil, 'E908: using an invalid value as a String', nil},
{lib.VAR_UNKNOWN, nil, 'E908: Using an invalid value as a String', nil},
}) do
-- Using to_cstr, cannot free with tv_clear
local tv = ffi.gc(typvalt(v[1], v[2]), nil)
@ -3072,15 +3072,15 @@ describe('typval.c', function()
for _, v in ipairs({
{lib.VAR_NUMBER, {v_number=42}, nil, '42'},
{lib.VAR_STRING, {v_string=to_cstr('100500')}, nil, '100500'},
{lib.VAR_FLOAT, {v_float=42.53}, 'E806: using Float as a String', ''},
{lib.VAR_PARTIAL, {v_partial=NULL}, 'E729: using Funcref as a String', ''},
{lib.VAR_FUNC, {v_string=NULL}, 'E729: using Funcref as a String', ''},
{lib.VAR_LIST, {v_list=NULL}, 'E730: using List as a String', ''},
{lib.VAR_DICT, {v_dict=NULL}, 'E731: using Dictionary as a String', ''},
{lib.VAR_FLOAT, {v_float=42.53}, 'E806: Using a Float as a String', ''},
{lib.VAR_PARTIAL, {v_partial=NULL}, 'E729: Using a Funcref as a String', ''},
{lib.VAR_FUNC, {v_string=NULL}, 'E729: Using a Funcref as a String', ''},
{lib.VAR_LIST, {v_list=NULL}, 'E730: Using a List as a String', ''},
{lib.VAR_DICT, {v_dict=NULL}, 'E731: Using a Dictionary as a String', ''},
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarNull}, nil, 'v:null'},
{lib.VAR_BOOL, {v_bool=lib.kBoolVarTrue}, nil, 'v:true'},
{lib.VAR_BOOL, {v_bool=lib.kBoolVarFalse}, nil, 'v:false'},
{lib.VAR_UNKNOWN, nil, 'E908: using an invalid value as a String', ''},
{lib.VAR_UNKNOWN, nil, 'E908: Using an invalid value as a String', ''},
}) do
-- Using to_cstr, cannot free with tv_clear
local tv = ffi.gc(typvalt(v[1], v[2]), nil)
@ -3115,15 +3115,15 @@ describe('typval.c', function()
for _, v in ipairs({
{lib.VAR_NUMBER, {v_number=42}, nil, '42'},
{lib.VAR_STRING, {v_string=to_cstr('100500')}, nil, '100500'},
{lib.VAR_FLOAT, {v_float=42.53}, 'E806: using Float as a String', nil},
{lib.VAR_PARTIAL, {v_partial=NULL}, 'E729: using Funcref as a String', nil},
{lib.VAR_FUNC, {v_string=NULL}, 'E729: using Funcref as a String', nil},
{lib.VAR_LIST, {v_list=NULL}, 'E730: using List as a String', nil},
{lib.VAR_DICT, {v_dict=NULL}, 'E731: using Dictionary as a String', nil},
{lib.VAR_FLOAT, {v_float=42.53}, 'E806: Using a Float as a String', nil},
{lib.VAR_PARTIAL, {v_partial=NULL}, 'E729: Using a Funcref as a String', nil},
{lib.VAR_FUNC, {v_string=NULL}, 'E729: Using a Funcref as a String', nil},
{lib.VAR_LIST, {v_list=NULL}, 'E730: Using a List as a String', nil},
{lib.VAR_DICT, {v_dict=NULL}, 'E731: Using a Dictionary as a String', nil},
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarNull}, nil, 'v:null'},
{lib.VAR_BOOL, {v_bool=lib.kBoolVarTrue}, nil, 'v:true'},
{lib.VAR_BOOL, {v_bool=lib.kBoolVarFalse}, nil, 'v:false'},
{lib.VAR_UNKNOWN, nil, 'E908: using an invalid value as a String', nil},
{lib.VAR_UNKNOWN, nil, 'E908: Using an invalid value as a String', nil},
}) do
-- Using to_cstr, cannot free with tv_clear
local tv = ffi.gc(typvalt(v[1], v[2]), nil)