fix(api): nvim_open_tabpage "after" like :[count]tab

Problem: "after" in nvim_open_tabpage is inconsistent with how a count works
with :tab, :tabnew, etc. Plus, the name "after" implies it's inserted after that
number.

Solution: internally offset by 1. Allow negative numbers to mean after current.

Hmm, should we even reserve sentinels for after current? Callers can probably
just use nil...
This commit is contained in:
Sean Dewar
2026-03-15 19:00:06 +00:00
parent cd4c98fded
commit 0c1ed63c05
4 changed files with 20 additions and 27 deletions

View File

@@ -1679,8 +1679,8 @@ function vim.api.nvim_notify(msg, log_level, opts) end
--- Use 0 for current buffer.
--- @param config vim.api.keyset.tabpage_config Configuration for the new tabpage. Keys:
--- - enter: Whether to enter the new tabpage (default: true)
--- - after: Position to insert tabpage (default: 0).
--- 0 = after current, 1 = first, N = before Nth.
--- - after: Position to insert tabpage (default: -1; after current).
--- 0 = first, N = after Nth.
--- @return integer # Tabpage handle of the created tabpage
function vim.api.nvim_open_tabpage(buffer, config) end