diff options
-rw-r--r-- | src/ex_docmd.c | 25 | ||||
-rw-r--r-- | src/globals.h | 1 | ||||
-rw-r--r-- | src/testdir/test_excmd.vim | 11 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 30 insertions, 9 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 74adb847b7..6df1c3189d 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -4208,6 +4208,15 @@ skip_range( return cmd; } + static void +addr_error(cmd_addr_T addr_type) +{ + if (addr_type == ADDR_NONE) + emsg(_(e_norange)); + else + emsg(_(e_invrange)); +} + /* * Get a single EX address. * @@ -4264,10 +4273,10 @@ get_address( case ADDR_TABS: lnum = CURRENT_TAB_NR; break; - case ADDR_TABS_RELATIVE: case ADDR_NONE: + case ADDR_TABS_RELATIVE: case ADDR_UNSIGNED: - emsg(_(e_invrange)); + addr_error(addr_type); cmd = NULL; goto error; break; @@ -4314,10 +4323,10 @@ get_address( case ADDR_TABS: lnum = LAST_TAB_NR; break; - case ADDR_TABS_RELATIVE: case ADDR_NONE: + case ADDR_TABS_RELATIVE: case ADDR_UNSIGNED: - emsg(_(e_invrange)); + addr_error(addr_type); cmd = NULL; goto error; break; @@ -4346,7 +4355,7 @@ get_address( } if (addr_type != ADDR_LINES) { - emsg(_(e_invaddr)); + addr_error(addr_type); cmd = NULL; goto error; } @@ -4378,7 +4387,7 @@ get_address( c = *cmd++; if (addr_type != ADDR_LINES) { - emsg(_(e_invaddr)); + addr_error(addr_type); cmd = NULL; goto error; } @@ -4428,7 +4437,7 @@ get_address( ++cmd; if (addr_type != ADDR_LINES) { - emsg(_(e_invaddr)); + addr_error(addr_type); cmd = NULL; goto error; } @@ -7926,7 +7935,7 @@ ex_copymove(exarg_T *eap) */ if (n == MAXLNUM || n < 0 || n > curbuf->b_ml.ml_line_count) { - emsg(_(e_invaddr)); + emsg(_(e_invrange)); return; } diff --git a/src/globals.h b/src/globals.h index 92b28030ff..e6a5bb2e94 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1456,7 +1456,6 @@ EXTERN char e_fontwidth[] INIT(= N_("E236: Font \"%s\" is not fixed-width")); EXTERN char e_internal[] INIT(= N_("E473: Internal error")); EXTERN char e_intern2[] INIT(= N_("E685: Internal error: %s")); EXTERN char e_interr[] INIT(= N_("Interrupted")); -EXTERN char e_invaddr[] INIT(= N_("E14: Invalid address")); EXTERN char e_invarg[] INIT(= N_("E474: Invalid argument")); EXTERN char e_invarg2[] INIT(= N_("E475: Invalid argument: %s")); EXTERN char e_duparg2[] INIT(= N_("E983: Duplicate argument: %s")); diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim index f5ce979208..509d78dfba 100644 --- a/src/testdir/test_excmd.vim +++ b/src/testdir/test_excmd.vim @@ -8,3 +8,14 @@ func Test_ex_delete() .dl call assert_equal(['a', 'c'], getline(1, 2)) endfunc + +func Test_range_error() + call assert_fails(':.echo 1', 'E481:') + call assert_fails(':$echo 1', 'E481:') + call assert_fails(':1,2echo 1', 'E481:') + call assert_fails(':+1echo 1', 'E481:') + call assert_fails(':/1/echo 1', 'E481:') + call assert_fails(':\/echo 1', 'E481:') + normal vv + call assert_fails(":'<,'>echo 1", 'E481:') +endfunc diff --git a/src/version.c b/src/version.c index aad7833767..0e1641c5f3 100644 --- a/src/version.c +++ b/src/version.c @@ -774,6 +774,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1822, +/**/ 1821, /**/ 1820, |