1
0
forked from aniani/vim

patch 8.1.1822: confusing error message when range is not allowed

Problem:    Confusing error message when range is not allowed.
Solution:   With ADDR_NONE give e_norange.  Change e_invaddr to e_invrange for
            consistency.
This commit is contained in:
Bram Moolenaar
2019-08-06 21:29:29 +02:00
parent f97d46f816
commit 0acae7acc4
4 changed files with 30 additions and 9 deletions

View File

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