diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-01-02 04:06:18 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-01-02 12:20:35 -0500 |
commit | 215aa83b2af85939900739a94f0d4d00902a2fed (patch) | |
tree | 0669fc5c8632c2e74ac7d617fb5b44a341de44b5 /src/nvim/ex_docmd.c | |
parent | cb5ba225f870d421fb83b49c360218e9be34a80d (diff) | |
download | rneovim-215aa83b2af85939900739a94f0d4d00902a2fed.tar.gz rneovim-215aa83b2af85939900739a94f0d4d00902a2fed.tar.bz2 rneovim-215aa83b2af85939900739a94f0d4d00902a2fed.zip |
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.
https://github.com/vim/vim/commit/0acae7acc40b9f12bff88d5e1dae494a761fec07
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 397157f238..ccf7dd0f68 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3729,6 +3729,15 @@ char_u *skip_range( return (char_u *)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 // // Set ptr to the next character after the part that was interpreted. @@ -3778,10 +3787,10 @@ static linenr_T get_address(exarg_T *eap, 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; @@ -3823,10 +3832,10 @@ static linenr_T get_address(exarg_T *eap, 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; @@ -3851,7 +3860,7 @@ static linenr_T get_address(exarg_T *eap, goto error; } if (addr_type != ADDR_LINES) { - EMSG(_(e_invaddr)); + addr_error(addr_type); cmd = NULL; goto error; } @@ -3879,7 +3888,7 @@ static linenr_T get_address(exarg_T *eap, case '?': /* '/' or '?' - search */ c = *cmd++; if (addr_type != ADDR_LINES) { - EMSG(_(e_invaddr)); + addr_error(addr_type); cmd = NULL; goto error; } @@ -3926,7 +3935,7 @@ static linenr_T get_address(exarg_T *eap, case '\\': /* "\?", "\/" or "\&", repeat search */ ++cmd; if (addr_type != ADDR_LINES) { - EMSG(_(e_invaddr)); + addr_error(addr_type); cmd = NULL; goto error; } @@ -7863,7 +7872,7 @@ static void ex_copymove(exarg_T *eap) * move or copy lines from 'eap->line1'-'eap->line2' to below line 'n' */ if (n == MAXLNUM || n < 0 || n > curbuf->b_ml.ml_line_count) { - EMSG(_(e_invaddr)); + EMSG(_(e_invrange)); return; } |