aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-02 21:48:10 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-02-11 15:29:18 +0100
commit6df80e8762c4c7bd08434e203500aa4642123326 (patch)
treec1d940d250f0ba61ec1d709a4de951ffde6762d2 /src
parent77bfbc3006f99f926465063b2ba8a66c6b11fd9a (diff)
downloadrneovim-6df80e8762c4c7bd08434e203500aa4642123326.tar.gz
rneovim-6df80e8762c4c7bd08434e203500aa4642123326.tar.bz2
rneovim-6df80e8762c4c7bd08434e203500aa4642123326.zip
vim-patch:8.0.0439: ":%argdel" gives an error for an empty arglist
Problem: Using ":%argdel" while the argument list is already empty gives an error. (Pavol Juhas) Solution: Don't give an error. (closes vim/vim#1546) https://github.com/vim/vim/commit/69a92fb5aecdf2f9d5f6947790b18991b22d0e4c Also: vim-patch:8.0.0473
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds2.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 28b021d4e4..0d3d68b855 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1959,8 +1959,14 @@ void ex_argdelete(exarg_T *eap)
eap->line2 = ARGCOUNT;
}
linenr_T n = eap->line2 - eap->line1 + 1;
- if (*eap->arg != NUL || n <= 0) {
+ if (*eap->arg != NUL) {
+ // Can't have both a range and an argument.
EMSG(_(e_invarg));
+ } else if (n <= 0) {
+ // Don't give an error for ":%argdel" if the list is empty.
+ if (eap->line1 != 1 || eap->line2 != 0) {
+ EMSG(_(e_invrange));
+ }
} else {
for (linenr_T i = eap->line1; i <= eap->line2; i++) {
xfree(ARGLIST[i - 1].ae_fname);