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

@@ -1846,7 +1846,7 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()*
• keeppatterns: (boolean) |:keeppatterns|.
• lockmarks: (boolean) |:lockmarks|.
• noswapfile: (boolean) |:noswapfile|.
• tab: (integer) |:tab|.
• tab: (integer) |:tab|. -1 when omitted.
• verbose: (integer) |:verbose|. -1 when omitted.
• vertical: (boolean) |:vertical|.
• split: (string) Split modifier string, is an empty string when

View File

@@ -671,7 +671,7 @@ function M.open_page(count, smods, args)
local target = ('%s(%s)'):format(name, sect)
local ok, ret = pcall(function()
if not smods.tab and find_man() then
if smods.tab == -1 and find_man() then
vim.cmd.tag({ target, mods = { silent = true, keepalt = true } })
else
smods.silent = true