mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.1123
Problem: Using ":argadd" when there are no arguments results in the second
argument to be the current one. (Yegappan Lakshmanan)
Solution: Correct the w_arg_idx value.
a24f0a550f
This commit is contained in:
parent
1573aa0b0a
commit
dfdf7c02be
@ -2098,6 +2098,7 @@ alist_add_list (
|
||||
int after /* where to add: 0 = before first one */
|
||||
)
|
||||
{
|
||||
int old_argcount = ARGCOUNT;
|
||||
ga_grow(&ALIST(curwin)->al_ga, count);
|
||||
{
|
||||
if (after < 0)
|
||||
@ -2112,8 +2113,9 @@ alist_add_list (
|
||||
ARGLIST[after + i].ae_fnum = buflist_add(files[i], BLN_LISTED);
|
||||
}
|
||||
ALIST(curwin)->al_ga.ga_len += count;
|
||||
if (curwin->w_arg_idx >= after)
|
||||
++curwin->w_arg_idx;
|
||||
if (old_argcount > 0 && curwin->w_arg_idx >= after) {
|
||||
curwin->w_arg_idx += count;
|
||||
}
|
||||
return after;
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ static int included_patches[] = {
|
||||
// 1126,
|
||||
// 1125 NA
|
||||
// 1124 NA
|
||||
// 1123,
|
||||
1123,
|
||||
// 1122 NA
|
||||
// 1121,
|
||||
1120,
|
||||
|
@ -8,7 +8,19 @@ local eq, eval = helpers.eq, helpers.eval
|
||||
describe('argument list commands', function()
|
||||
before_each(clear)
|
||||
|
||||
it('is working', function()
|
||||
function assert_argc(l)
|
||||
eq(#l, eval('argc()'))
|
||||
for i = 1, #l do
|
||||
eq(l[i], eval('argv(' .. (i - 1) .. ')'))
|
||||
end
|
||||
end
|
||||
|
||||
function init_abc()
|
||||
execute('args a b c')
|
||||
execute('next')
|
||||
end
|
||||
|
||||
it('test that argidx() works', function()
|
||||
execute('args a b c')
|
||||
execute('last')
|
||||
eq(2, eval('argidx()'))
|
||||
@ -28,4 +40,42 @@ describe('argument list commands', function()
|
||||
execute('1argdelete')
|
||||
eq(0, eval('argidx()'))
|
||||
end)
|
||||
|
||||
it('test that argadd() works', function()
|
||||
execute('%argdelete')
|
||||
execute('argadd a b c')
|
||||
eq(0, eval('argidx()'))
|
||||
|
||||
execute('%argdelete')
|
||||
execute('argadd a')
|
||||
eq(0, eval('argidx()'))
|
||||
execute('argadd b c d')
|
||||
eq(0, eval('argidx()'))
|
||||
|
||||
init_abc()
|
||||
execute('argadd x')
|
||||
assert_argc({'a', 'b', 'x', 'c'})
|
||||
eq(1, eval('argidx()'))
|
||||
|
||||
init_abc()
|
||||
execute('0argadd x')
|
||||
assert_argc({'x', 'a', 'b', 'c'})
|
||||
eq(2, eval('argidx()'))
|
||||
|
||||
init_abc()
|
||||
execute('1argadd x')
|
||||
assert_argc({'a', 'x', 'b', 'c'})
|
||||
eq(2, eval('argidx()'))
|
||||
|
||||
init_abc()
|
||||
execute('$argadd x')
|
||||
assert_argc({'a', 'b', 'c', 'x'})
|
||||
eq(1, eval('argidx()'))
|
||||
|
||||
init_abc()
|
||||
execute('$argadd x')
|
||||
execute('+2argadd y')
|
||||
assert_argc({'a', 'b', 'c', 'x', 'y'})
|
||||
eq(1, eval('argidx()'))
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user