1
0
forked from aniani/vim

patch 8.2.3197: error messages are spread out

Problem:    Error messages are spread out.
Solution:   Move a few more error messages to errors.h.
This commit is contained in:
Bram Moolenaar
2021-07-21 22:20:33 +02:00
parent 05bd9785fd
commit d8e44476d8
15 changed files with 61 additions and 35 deletions

View File

@@ -165,7 +165,7 @@ edit(
// Don't allow inserting in the sandbox. // Don't allow inserting in the sandbox.
if (sandbox != 0) if (sandbox != 0)
{ {
emsg(_(e_sandbox)); emsg(_(e_not_allowed_in_sandbox));
return FALSE; return FALSE;
} }
#endif #endif

View File

@@ -104,10 +104,43 @@ EXTERN char e_corrupted_regexp_program[]
INIT(= N_("E44: Corrupted regexp program")); INIT(= N_("E44: Corrupted regexp program"));
EXTERN char e_readonly_option_is_set_add_bang_to_override[] EXTERN char e_readonly_option_is_set_add_bang_to_override[]
INIT(= N_("E45: 'readonly' option is set (add ! to override)")); INIT(= N_("E45: 'readonly' option is set (add ! to override)"));
#ifdef FEAT_EVAL
EXTERN char e_cannot_change_readonly_variable_str[]
INIT(= N_("E46: Cannot change read-only variable \"%s\""));
#endif
#ifdef FEAT_QUICKFIX
EXTERN char e_error_while_reading_errorfile[]
INIT(= N_("E47: Error while reading errorfile"));
#endif
#ifdef HAVE_SANDBOX
EXTERN char e_not_allowed_in_sandbox[]
INIT(= N_("E48: Not allowed in sandbox"));
#endif
EXTERN char e_invalid_scroll_size[]
INIT(= N_("E49: Invalid scroll size"));
EXTERN char e_too_many_z[]
INIT(= N_("E50: Too many \\z("));
EXTERN char e_too_many_str_open[]
INIT(= N_("E51: Too many %s("));
EXTERN char e_unmatched_z[]
INIT(= N_("E52: Unmatched \\z("));
EXTERN char e_unmatched_str_percent_open[]
INIT(= N_("E53: Unmatched %s%%("));
EXTERN char e_unmatched_str_open[]
INIT(= N_("E54: Unmatched %s("));
EXTERN char e_unmatched_str_close[]
INIT(= N_("E55: Unmatched %s)"));
EXTERN char e_invalid_character_after_str_at[]
INIT(= N_("E59: invalid character after %s@"));
EXTERN char e_too_many_complex_str_curly[]
INIT(= N_("E60: Too many complex %s{...}s"));
#ifdef FEAT_EVAL
EXTERN char e_undefined_variable_str[] EXTERN char e_undefined_variable_str[]
INIT(= N_("E121: Undefined variable: %s")); INIT(= N_("E121: Undefined variable: %s"));
EXTERN char e_undefined_variable_char_str[] EXTERN char e_undefined_variable_char_str[]
INIT(= N_("E121: Undefined variable: %c:%s")); INIT(= N_("E121: Undefined variable: %c:%s"));
#endif
#ifndef FEAT_DIGRAPHS #ifndef FEAT_DIGRAPHS
EXTERN char e_no_digraphs_version[] EXTERN char e_no_digraphs_version[]
INIT(= N_("E196: No digraphs in this version")); INIT(= N_("E196: No digraphs in this version"));

View File

@@ -2232,7 +2232,7 @@ set_vim_var_tv(int idx, typval_T *tv)
// VV_RO is also checked when compiling, but let's check here as well. // VV_RO is also checked when compiling, but let's check here as well.
if (vimvars[idx].vv_flags & VV_RO) if (vimvars[idx].vv_flags & VV_RO)
{ {
semsg(_(e_readonlyvar), vimvars[idx].vv_name); semsg(_(e_cannot_change_readonly_variable_str), vimvars[idx].vv_name);
return FAIL; return FAIL;
} }
if (sandbox && (vimvars[idx].vv_flags & VV_RO_SBX)) if (sandbox && (vimvars[idx].vv_flags & VV_RO_SBX))
@@ -3499,7 +3499,8 @@ var_check_ro(int flags, char_u *name, int use_gettext)
{ {
if (flags & DI_FLAGS_RO) if (flags & DI_FLAGS_RO)
{ {
semsg(_(e_readonlyvar), use_gettext ? (char_u *)_(name) : name); semsg(_(e_cannot_change_readonly_variable_str),
use_gettext ? (char_u *)_(name) : name);
return TRUE; return TRUE;
} }
if ((flags & DI_FLAGS_RO_SBX) && sandbox) if ((flags & DI_FLAGS_RO_SBX) && sandbox)

View File

@@ -3596,7 +3596,7 @@ check_secure(void)
*/ */
if (sandbox != 0) if (sandbox != 0)
{ {
emsg(_(e_sandbox)); emsg(_(e_not_allowed_in_sandbox));
return TRUE; return TRUE;
} }
#endif #endif

View File

@@ -2112,7 +2112,7 @@ do_one_cmd(
if (sandbox != 0 && !(ea.argt & EX_SBOXOK)) if (sandbox != 0 && !(ea.argt & EX_SBOXOK))
{ {
// Command not allowed in sandbox. // Command not allowed in sandbox.
errormsg = _(e_sandbox); errormsg = _(e_not_allowed_in_sandbox);
goto doend; goto doend;
} }
#endif #endif

View File

@@ -1666,7 +1666,6 @@ EXTERN char e_loclist[] INIT(= N_("E776: No location list"));
EXTERN char e_letwrong[] INIT(= N_("E734: Wrong variable type for %s=")); EXTERN char e_letwrong[] INIT(= N_("E734: Wrong variable type for %s="));
EXTERN char e_illvar[] INIT(= N_("E461: Illegal variable name: %s")); EXTERN char e_illvar[] INIT(= N_("E461: Illegal variable name: %s"));
EXTERN char e_cannot_mod[] INIT(= N_("E995: Cannot modify existing variable")); EXTERN char e_cannot_mod[] INIT(= N_("E995: Cannot modify existing variable"));
EXTERN char e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%s\""));
EXTERN char e_readonlysbx[] INIT(= N_("E794: Cannot set variable in the sandbox: \"%s\"")); EXTERN char e_readonlysbx[] INIT(= N_("E794: Cannot set variable in the sandbox: \"%s\""));
EXTERN char e_stringreq[] INIT(= N_("E928: String required")); EXTERN char e_stringreq[] INIT(= N_("E928: String required"));
EXTERN char e_numberreq[] INIT(= N_("E889: Number required")); EXTERN char e_numberreq[] INIT(= N_("E889: Number required"));
@@ -1692,12 +1691,6 @@ EXTERN char e_unknown_option[] INIT(= N_("E113: Unknown option: %s"));
EXTERN char e_reduceempty[] INIT(= N_("E998: Reduce of an empty %s with no initial value")); EXTERN char e_reduceempty[] INIT(= N_("E998: Reduce of an empty %s with no initial value"));
EXTERN char e_no_dict_key[] INIT(= N_("E857: Dictionary key \"%s\" required")); EXTERN char e_no_dict_key[] INIT(= N_("E857: Dictionary key \"%s\" required"));
#endif #endif
#ifdef FEAT_QUICKFIX
EXTERN char e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
#endif
#ifdef HAVE_SANDBOX
EXTERN char e_sandbox[] INIT(= N_("E48: Not allowed in sandbox"));
#endif
EXTERN char e_secure[] INIT(= N_("E523: Not allowed here")); EXTERN char e_secure[] INIT(= N_("E523: Not allowed here"));
EXTERN char e_textlock[] INIT(= N_("E578: Not allowed to change text here")); EXTERN char e_textlock[] INIT(= N_("E578: Not allowed to change text here"));
EXTERN char e_textwinlock[] INIT(= N_("E565: Not allowed to change text or change window")); EXTERN char e_textwinlock[] INIT(= N_("E565: Not allowed to change text or change window"));
@@ -1705,7 +1698,6 @@ EXTERN char e_textwinlock[] INIT(= N_("E565: Not allowed to change text or chang
|| defined(UNIX) || defined(VMS) || defined(UNIX) || defined(VMS)
EXTERN char e_screenmode[] INIT(= N_("E359: Screen mode setting not supported")); EXTERN char e_screenmode[] INIT(= N_("E359: Screen mode setting not supported"));
#endif #endif
EXTERN char e_scroll[] INIT(= N_("E49: Invalid scroll size"));
EXTERN char e_shellempty[] INIT(= N_("E91: 'shell' option is empty")); EXTERN char e_shellempty[] INIT(= N_("E91: 'shell' option is empty"));
#if defined(FEAT_SIGN_ICONS) && !defined(FEAT_GUI_GTK) #if defined(FEAT_SIGN_ICONS) && !defined(FEAT_GUI_GTK)
EXTERN char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!")); EXTERN char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!"));

View File

@@ -1485,7 +1485,7 @@ do_set(
// Disallow changing some options in the sandbox // Disallow changing some options in the sandbox
if (sandbox != 0 && (flags & P_SECURE)) if (sandbox != 0 && (flags & P_SECURE))
{ {
errmsg = e_sandbox; errmsg = e_not_allowed_in_sandbox;
goto skip; goto skip;
} }
#endif #endif
@@ -3757,7 +3757,7 @@ set_num_option(
if (pp == &(curwin->w_p_scr)) if (pp == &(curwin->w_p_scr))
{ {
if (curwin->w_p_scr != 0) if (curwin->w_p_scr != 0)
errmsg = e_scroll; errmsg = e_invalid_scroll_size;
win_comp_scroll(curwin); win_comp_scroll(curwin);
} }
// If 'scroll' became invalid because of a side effect silently adjust // If 'scroll' became invalid because of a side effect silently adjust
@@ -3793,7 +3793,7 @@ set_num_option(
p_sj = Rows / 2; p_sj = Rows / 2;
else else
{ {
errmsg = e_scroll; errmsg = e_invalid_scroll_size;
p_sj = 1; p_sj = 1;
} }
} }
@@ -4366,7 +4366,7 @@ set_option_value(
// Disallow changing some options in the sandbox // Disallow changing some options in the sandbox
if (sandbox > 0 && (flags & P_SECURE)) if (sandbox > 0 && (flags & P_SECURE))
{ {
emsg(_(e_sandbox)); emsg(_(e_not_allowed_in_sandbox));
return NULL; return NULL;
} }
#endif #endif

View File

@@ -1769,7 +1769,7 @@ qf_init_ext(
retval = qfl->qf_count; retval = qfl->qf_count;
goto qf_init_end; goto qf_init_end;
} }
emsg(_(e_readerrf)); emsg(_(e_error_while_reading_errorfile));
error2: error2:
if (!adding) if (!adding)
{ {

View File

@@ -74,9 +74,6 @@ toggle_Magic(int x)
static char_u e_missingbracket[] = N_("E769: Missing ] after %s["); static char_u e_missingbracket[] = N_("E769: Missing ] after %s[");
static char_u e_reverse_range[] = N_("E944: Reverse range in character class"); static char_u e_reverse_range[] = N_("E944: Reverse range in character class");
static char_u e_large_class[] = N_("E945: Range too large in character class"); static char_u e_large_class[] = N_("E945: Range too large in character class");
static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
static char_u e_unmatchedpar[] = N_("E55: Unmatched %s)");
#ifdef FEAT_SYN_HL #ifdef FEAT_SYN_HL
static char_u e_z_not_allowed[] = N_("E66: \\z( not allowed here"); static char_u e_z_not_allowed[] = N_("E66: \\z( not allowed here");
static char_u e_z1_not_allowed[] = N_("E67: \\z1 - \\z9 not allowed here"); static char_u e_z1_not_allowed[] = N_("E67: \\z1 - \\z9 not allowed here");

View File

@@ -2158,7 +2158,7 @@ regpiece(int *flagp)
} }
} }
if (lop == END) if (lop == END)
EMSG2_RET_NULL(_("E59: invalid character after %s@"), EMSG2_RET_NULL(_(e_invalid_character_after_str_at),
reg_magic == MAGIC_ALL); reg_magic == MAGIC_ALL);
// Look behind must match with behind_pos. // Look behind must match with behind_pos.
if (lop == BEHIND || lop == NOBEHIND) if (lop == BEHIND || lop == NOBEHIND)
@@ -2199,7 +2199,7 @@ regpiece(int *flagp)
else else
{ {
if (num_complex_braces >= 10) if (num_complex_braces >= 10)
EMSG2_RET_NULL(_("E60: Too many complex %s{...}s"), EMSG2_RET_NULL(_(e_too_many_complex_str_curly),
reg_magic == MAGIC_ALL); reg_magic == MAGIC_ALL);
reginsert(BRACE_COMPLEX + num_complex_braces, ret); reginsert(BRACE_COMPLEX + num_complex_braces, ret);
regoptail(ret, regnode(BACK)); regoptail(ret, regnode(BACK));
@@ -2369,7 +2369,7 @@ reg(
{ {
// Make a ZOPEN node. // Make a ZOPEN node.
if (regnzpar >= NSUBEXP) if (regnzpar >= NSUBEXP)
EMSG_RET_NULL(_("E50: Too many \\z(")); EMSG_RET_NULL(_(e_too_many_z));
parno = regnzpar; parno = regnzpar;
regnzpar++; regnzpar++;
ret = regnode(ZOPEN + parno); ret = regnode(ZOPEN + parno);
@@ -2380,7 +2380,7 @@ reg(
{ {
// Make a MOPEN node. // Make a MOPEN node.
if (regnpar >= NSUBEXP) if (regnpar >= NSUBEXP)
EMSG2_RET_NULL(_("E51: Too many %s("), reg_magic == MAGIC_ALL); EMSG2_RET_NULL(_(e_too_many_str_open), reg_magic == MAGIC_ALL);
parno = regnpar; parno = regnpar;
++regnpar; ++regnpar;
ret = regnode(MOPEN + parno); ret = regnode(MOPEN + parno);
@@ -2437,18 +2437,18 @@ reg(
{ {
#ifdef FEAT_SYN_HL #ifdef FEAT_SYN_HL
if (paren == REG_ZPAREN) if (paren == REG_ZPAREN)
EMSG_RET_NULL(_("E52: Unmatched \\z(")); EMSG_RET_NULL(_(e_unmatched_z));
else else
#endif #endif
if (paren == REG_NPAREN) if (paren == REG_NPAREN)
EMSG2_RET_NULL(_(e_unmatchedpp), reg_magic == MAGIC_ALL); EMSG2_RET_NULL(_(e_unmatched_str_percent_open), reg_magic == MAGIC_ALL);
else else
EMSG2_RET_NULL(_(e_unmatchedp), reg_magic == MAGIC_ALL); EMSG2_RET_NULL(_(e_unmatched_str_open), reg_magic == MAGIC_ALL);
} }
else if (paren == REG_NOPAREN && peekchr() != NUL) else if (paren == REG_NOPAREN && peekchr() != NUL)
{ {
if (curchr == Magic(')')) if (curchr == Magic(')'))
EMSG2_RET_NULL(_(e_unmatchedpar), reg_magic == MAGIC_ALL); EMSG2_RET_NULL(_(e_unmatched_str_close), reg_magic == MAGIC_ALL);
else else
EMSG_RET_NULL(_(e_trailing)); // "Can't happen". EMSG_RET_NULL(_(e_trailing)); // "Can't happen".
// NOTREACHED // NOTREACHED

View File

@@ -2561,14 +2561,15 @@ nfa_reg(
if (paren != REG_NOPAREN && getchr() != Magic(')')) if (paren != REG_NOPAREN && getchr() != Magic(')'))
{ {
if (paren == REG_NPAREN) if (paren == REG_NPAREN)
EMSG2_RET_FAIL(_(e_unmatchedpp), reg_magic == MAGIC_ALL); EMSG2_RET_FAIL(_(e_unmatched_str_percent_open),
reg_magic == MAGIC_ALL);
else else
EMSG2_RET_FAIL(_(e_unmatchedp), reg_magic == MAGIC_ALL); EMSG2_RET_FAIL(_(e_unmatched_str_open), reg_magic == MAGIC_ALL);
} }
else if (paren == REG_NOPAREN && peekchr() != NUL) else if (paren == REG_NOPAREN && peekchr() != NUL)
{ {
if (peekchr() == Magic(')')) if (peekchr() == Magic(')'))
EMSG2_RET_FAIL(_(e_unmatchedpar), reg_magic == MAGIC_ALL); EMSG2_RET_FAIL(_(e_unmatched_str_close), reg_magic == MAGIC_ALL);
else else
EMSG_RET_FAIL(_("E873: (NFA regexp) proper termination error")); EMSG_RET_FAIL(_("E873: (NFA regexp) proper termination error"));
} }

View File

@@ -324,7 +324,7 @@ undo_allowed(void)
// In the sandbox it's not allowed to change the text. // In the sandbox it's not allowed to change the text.
if (sandbox != 0) if (sandbox != 0)
{ {
emsg(_(e_sandbox)); emsg(_(e_not_allowed_in_sandbox));
return FALSE; return FALSE;
} }
#endif #endif

View File

@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3197,
/**/ /**/
3196, 3196,
/**/ /**/

View File

@@ -2477,7 +2477,7 @@ check_item_writable(svar_T *sv, int check_writable, char_u *name)
|| (check_writable == ASSIGN_FINAL || (check_writable == ASSIGN_FINAL
&& sv->sv_const == ASSIGN_CONST)) && sv->sv_const == ASSIGN_CONST))
{ {
semsg(_(e_readonlyvar), name); semsg(_(e_cannot_change_readonly_variable_str), name);
return FAIL; return FAIL;
} }
return OK; return OK;

View File

@@ -962,7 +962,7 @@ check_script_var_type(
{ {
if (sv->sv_const != 0) if (sv->sv_const != 0)
{ {
semsg(_(e_readonlyvar), name); semsg(_(e_cannot_change_readonly_variable_str), name);
return FAIL; return FAIL;
} }
ret = check_typval_type(sv->sv_type, value, where); ret = check_typval_type(sv->sv_type, value, where);