fix(api)!: correctly deal with number before :tab

Now nvim_parse_cmd and nvim_create_user_command use a "tab" value which
is the same as the number passed before :tab modifier instead of the
number plus 1, and "tab" value is -1 if :tab modifier is not used.
This commit is contained in:
zeertzjq
2022-09-01 18:46:34 +08:00
parent 2afcdbd63a
commit 1ef7720567
6 changed files with 54 additions and 31 deletions

View File

@@ -3206,7 +3206,7 @@ describe('API', function()
sandbox = false,
silent = false,
split = "",
tab = 0,
tab = -1,
unsilent = false,
verbose = -1,
vertical = false,
@@ -3248,7 +3248,7 @@ describe('API', function()
sandbox = false,
silent = false,
split = "",
tab = 0,
tab = -1,
unsilent = false,
verbose = -1,
vertical = false,
@@ -3290,7 +3290,7 @@ describe('API', function()
sandbox = false,
silent = false,
split = "",
tab = 0,
tab = -1,
unsilent = false,
verbose = -1,
vertical = false,
@@ -3332,7 +3332,7 @@ describe('API', function()
sandbox = false,
silent = false,
split = "",
tab = 0,
tab = -1,
unsilent = false,
verbose = -1,
vertical = false,
@@ -3374,7 +3374,7 @@ describe('API', function()
sandbox = false,
silent = false,
split = "",
tab = 0,
tab = -1,
unsilent = false,
verbose = -1,
vertical = false,
@@ -3416,7 +3416,7 @@ describe('API', function()
sandbox = false,
silent = false,
split = "",
tab = 0,
tab = -1,
unsilent = false,
verbose = -1,
vertical = false,
@@ -3458,7 +3458,7 @@ describe('API', function()
sandbox = false,
silent = true,
split = "topleft",
tab = 2,
tab = 1,
unsilent = false,
verbose = 15,
vertical = false,
@@ -3503,7 +3503,7 @@ describe('API', function()
verbose = 0,
vertical = false,
},
}, meths.parse_cmd('0verbose unsilent botright confirm filter! /foo/ split foo.txt', {}))
}, meths.parse_cmd('0verbose unsilent botright 0tab confirm filter! /foo/ split foo.txt', {}))
end)
it('works with user commands', function()
command('command -bang -nargs=+ -range -addr=lines MyCommand echo foo')
@@ -3541,7 +3541,7 @@ describe('API', function()
sandbox = false,
silent = false,
split = "",
tab = 0,
tab = -1,
unsilent = false,
verbose = -1,
vertical = false,
@@ -3583,7 +3583,7 @@ describe('API', function()
sandbox = false,
silent = false,
split = "",
tab = 0,
tab = -1,
unsilent = false,
verbose = -1,
vertical = false,
@@ -3626,7 +3626,7 @@ describe('API', function()
sandbox = false,
silent = false,
split = "",
tab = 0,
tab = -1,
unsilent = false,
verbose = -1,
vertical = false,
@@ -3719,7 +3719,7 @@ describe('API', function()
sandbox = false,
silent = false,
split = "",
tab = 0,
tab = -1,
unsilent = false,
verbose = -1,
vertical = false,