0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2216: Vim9: range with missing colon can be hard to spot

Problem:    Vim9: range with missing colon can be hard to spot.
Solution:   Include the start of the range in the error. (closes #7543)
This commit is contained in:
Bram Moolenaar
2020-12-25 19:25:45 +01:00
parent 56ce9ea3ea
commit 6e2c2c50ba
5 changed files with 7 additions and 5 deletions

View File

@@ -133,8 +133,8 @@ EXTERN char e_item_not_found_in_script_str[]
INIT(= N_("E1048: Item not found in script: %s")); INIT(= N_("E1048: Item not found in script: %s"));
EXTERN char e_item_not_exported_in_script_str[] EXTERN char e_item_not_exported_in_script_str[]
INIT(= N_("E1049: Item not exported in script: %s")); INIT(= N_("E1049: Item not exported in script: %s"));
EXTERN char e_colon_required_before_a_range[] EXTERN char e_colon_required_before_range_str[]
INIT(= N_("E1050: Colon required before a range")); INIT(= N_("E1050: Colon required before a range: %s"));
EXTERN char e_wrong_argument_type_for_plus[] EXTERN char e_wrong_argument_type_for_plus[]
INIT(= N_("E1051: Wrong argument type for +")); INIT(= N_("E1051: Wrong argument type for +"));
EXTERN char e_cannot_declare_an_option[] EXTERN char e_cannot_declare_an_option[]

View File

@@ -1839,7 +1839,7 @@ do_one_cmd(
// message. // message.
if (ar > ea.cmd) if (ar > ea.cmd)
{ {
emsg(_(e_colon_required_before_a_range)); semsg(_(e_colon_required_before_range_str), ea.cmd);
goto doend; goto doend;
} }
} }

View File

@@ -549,7 +549,7 @@ def Test_modifier_silent_unsilent()
enddef enddef
def Test_range_after_command_modifier() def Test_range_after_command_modifier()
CheckScriptFailure(['vim9script', 'silent keepjump 1d _'], 'E1050:', 2) CheckScriptFailure(['vim9script', 'silent keepjump 1d _'], 'E1050: Colon required before a range: 1d _', 2)
new new
setline(1, 'xxx') setline(1, 'xxx')
CheckScriptSuccess(['vim9script', 'silent keepjump :1d _']) CheckScriptSuccess(['vim9script', 'silent keepjump :1d _'])

View File

@@ -750,6 +750,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 */
/**/
2216,
/**/ /**/
2215, 2215,
/**/ /**/

View File

@@ -7727,7 +7727,7 @@ compile_def_function(ufunc_T *ufunc, int check_return_type, cctx_T *outer_cctx)
{ {
if (!starts_with_colon) if (!starts_with_colon)
{ {
emsg(_(e_colon_required_before_a_range)); semsg(_(e_colon_required_before_range_str), cmd);
goto erret; goto erret;
} }
if (ends_excmd2(line, ea.cmd)) if (ends_excmd2(line, ea.cmd))