From 6df80e8762c4c7bd08434e203500aa4642123326 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 2 Feb 2018 21:48:10 +0100 Subject: [PATCH] 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 --- src/nvim/ex_cmds2.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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);