aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds2.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-08-17 18:43:40 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-08-17 23:34:39 -0400
commit45615cedd10fb5dc3c502815ed4d98b6d4e4488a (patch)
tree87df9ab14c1907990e84ab871695284d953140da /src/nvim/ex_cmds2.c
parent27a67288485d890cd514bced11833fa010ed0b92 (diff)
downloadrneovim-45615cedd10fb5dc3c502815ed4d98b6d4e4488a.tar.gz
rneovim-45615cedd10fb5dc3c502815ed4d98b6d4e4488a.tar.bz2
rneovim-45615cedd10fb5dc3c502815ed4d98b6d4e4488a.zip
vim-patch:8.2.1472: ":argdel" does not work like ":.argdel" as documented
Problem: ":argdel" does not work like ":.argdel" as documented. (Alexey Demin) Solution: Make ":argdel" work like ":.argdel". (closes vim/vim#6727) Also fix giving the error "0 more files to edit". https://github.com/vim/vim/commit/7b22117c4ecf383b6f35acef041773a83ec28220
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r--src/nvim/ex_cmds2.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 7f4b01e306..7a06cb7ca6 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1984,9 +1984,16 @@ void ex_argadd(exarg_T *eap)
/// ":argdelete"
void ex_argdelete(exarg_T *eap)
{
- if (eap->addr_count > 0) {
- // ":1,4argdel": Delete all arguments in the range.
- if (eap->line2 > ARGCOUNT) {
+ if (eap->addr_count > 0 || *eap->arg == NUL) {
+ // ":argdel" works like ":.argdel"
+ if (eap->addr_count == 0) {
+ if (curwin->w_arg_idx >= ARGCOUNT) {
+ EMSG(_("E610: No argument to delete"));
+ return;
+ }
+ eap->line1 = eap->line2 = curwin->w_arg_idx + 1;
+ } else if (eap->line2 > ARGCOUNT) {
+ // ":1,4argdel": Delete all arguments in the range.
eap->line2 = ARGCOUNT;
}
linenr_T n = eap->line2 - eap->line1 + 1;
@@ -2016,8 +2023,6 @@ void ex_argdelete(exarg_T *eap)
curwin->w_arg_idx = ARGCOUNT - 1;
}
}
- } else if (*eap->arg == NUL) {
- EMSG(_(e_argreq));
} else {
do_arglist(eap->arg, AL_DEL, 0);
}