mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
vim-patch:7.4.1119
Problem: argidx() has a wrong value after ":%argdelete". (Yegappan
Lakshmanan)
Solution: Correct the value of w_arg_idx. Add a test.
72defda84e
This commit is contained in:
@@ -1861,11 +1861,17 @@ void ex_argdelete(exarg_T *eap)
|
||||
} else if (curwin->w_arg_idx > eap->line1) {
|
||||
curwin->w_arg_idx = (int)eap->line1;
|
||||
}
|
||||
if (ARGCOUNT == 0) {
|
||||
curwin->w_arg_idx = 0;
|
||||
} else if (curwin->w_arg_idx >= ARGCOUNT) {
|
||||
curwin->w_arg_idx = ARGCOUNT - 1;
|
||||
}
|
||||
}
|
||||
} else if (*eap->arg == NUL)
|
||||
} else if (*eap->arg == NUL) {
|
||||
EMSG(_(e_argreq));
|
||||
else
|
||||
} else {
|
||||
do_arglist(eap->arg, AL_DEL, 0);
|
||||
}
|
||||
maketitle();
|
||||
}
|
||||
|
||||
|
@@ -563,7 +563,7 @@ static int included_patches[] = {
|
||||
// 1122 NA
|
||||
// 1121,
|
||||
1120,
|
||||
// 1119,
|
||||
1119,
|
||||
1118,
|
||||
1117,
|
||||
1116,
|
||||
|
31
test/functional/legacy/arglist_spec.lua
Normal file
31
test/functional/legacy/arglist_spec.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
-- Test argument list commands
|
||||
|
||||
local helpers = require('test.functional.helpers')
|
||||
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
||||
local execute, expect = helpers.execute, helpers.expect
|
||||
local eq, eval = helpers.eq, helpers.eval
|
||||
|
||||
describe('argument list commands', function()
|
||||
before_each(clear)
|
||||
|
||||
it('is working', function()
|
||||
execute('args a b c')
|
||||
execute('last')
|
||||
eq(2, eval('argidx()'))
|
||||
execute('%argdelete')
|
||||
eq(0, eval('argidx()'))
|
||||
|
||||
execute('args a b c')
|
||||
eq(0, eval('argidx()'))
|
||||
execute('next')
|
||||
eq(1, eval('argidx()'))
|
||||
execute('next')
|
||||
eq(2, eval('argidx()'))
|
||||
execute('1argdelete')
|
||||
eq(1, eval('argidx()'))
|
||||
execute('1argdelete')
|
||||
eq(0, eval('argidx()'))
|
||||
execute('1argdelete')
|
||||
eq(0, eval('argidx()'))
|
||||
end)
|
||||
end)
|
Reference in New Issue
Block a user