This commit is contained in:
Justin M. Keyes
2026-05-17 10:02:12 -04:00
committed by GitHub
parent 3ace049c6a
commit c55b6128f8
7 changed files with 22 additions and 26 deletions

View File

@@ -1166,9 +1166,10 @@ TabLeave Just before leaving a |tabpage|.
After WinLeave.
*TabMoved*
TabMoved After a |tabpage| is moved.
See |:tabmove|. <amatch> expands to the
affected |tabpage-number| before the move.
TabMoved After a |tabpage| is moved (by |:tabmove| or
mouse drag). <amatch> expands to the old
|tabpage-number| before the move.
The |event-data| has these keys (type: `vim.event.tabmoved.data`)
- tabnr_old: |tabpage-number| before the move.
- tabnr_new: |tabpage-number| after the move.

View File

@@ -1467,7 +1467,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'cmdheight'* *'ch'*
'cmdheight' 'ch' number (default 1)
global or local to tab page
global or local to tabpage
Number of screen lines to use for the command-line. Helps avoiding
|hit-enter| prompts.
The value of this option is stored with the tabpage, so that each

View File

@@ -37,10 +37,10 @@ Each tabpage has an unique identifier which will not change, even after
rearranging tabs. |nvim_get_current_tabpage()| returns the tab-id and
|nvim_list_tabpages()| lists tab-ids in the order they're displayed.
*tabpage-number*
Tabpages are also numbered from left to right starting at 1: this is the tab
"number" returned by |tabpagenr()|, not the tab-id. The tab number may change
when tabs are opened, closed, or rearranged. |nvim_tabpage_get_number()|
converts a tab-id to a tab number.
Tabpages are numbered from left to right starting at 1: this tab "number" is
returned by |tabpagenr()|. Unlike the tab-id, the tab number may change when
tabs are opened, closed, or rearranged. |nvim_tabpage_get_number()| converts
a tab-id to a tab number.
==============================================================================

View File

@@ -82,10 +82,10 @@ Each window has a unique identifier called the window ID, which is permanent
during the Nvim session. The |win_getid()| and |win_id2tabwin()| functions
convert between the window/tab "number" and the identifier.
*window-number*
Windows are also numbered according to their arrangement in a tabpage; this
window "number" is given by |winnr()| and may change whenever windows are
opened or closed. The window number is only valid in one specific tab, whereas
the window ID is valid globally, across tabs. For most functions that take
Windows are numbered according to their arrangement in a tabpage; this window
"number" is given by |winnr()| and may change whenever windows are opened or
closed. The window number is only valid in one specific tab, whereas the
window ID is valid globally, across tabs. For most functions that take
a window ID or a window number, the window number only applies to the current
tab, while the window ID can refer to a window in any tab.

View File

@@ -719,7 +719,7 @@ local function option_scope_doc(o)
global = 'global',
buf = 'local to buffer',
win = 'local to window',
tab = 'local to tab page',
tab = 'local to tabpage',
}
local r --- @type string

View File

@@ -4081,7 +4081,7 @@ void set_option_direct_for(OptIndex opt_idx, OptVal value, int opt_flags, scid_T
curbuf = save_curbuf;
}
/// Set the value of an option.
/// Sets the value of an (non-tty) option.
///
/// @param opt_idx Index in options[] table. Must not be kOptInvalid.
/// @param[in] value Option value. If NIL_OPTVAL, the option value is cleared.

View File

@@ -5,7 +5,6 @@ local Screen = require('test.functional.ui.screen')
local clear = n.clear
local command = n.command
local exec_lua = n.exec_lua
local insert = n.insert
local poke_eventloop = n.poke_eventloop
local api = n.api
local eval = n.eval
@@ -17,7 +16,7 @@ describe('TabMoved', function()
clear()
end)
it('sets <amatch> and event-data fields', function()
it('sets <amatch>, event-data', function()
-- start on tabpage 1, create 2 more so tabpage 3 is "current tab"
command('tabnew')
command('tabnew')
@@ -35,23 +34,20 @@ describe('TabMoved', function()
poke_eventloop()
local events = exec_lua('return _G.tm_events')
eq('3', events[1].match)
eq(3, events[1].data.tabnr_old)
eq(1, events[1].data.tabnr_new)
eq({ tabnr_new = 1, tabnr_old = 3 }, events[1].data)
command('tabnext 2')
command('tabmove $')
poke_eventloop()
events = exec_lua('return _G.tm_events')
eq('2', events[2].match)
eq(2, events[2].data.tabnr_old)
eq(3, events[2].data.tabnr_new)
eq({ tabnr_new = 3, tabnr_old = 2 }, events[2].data)
command('tabmove -1')
poke_eventloop()
events = exec_lua('return _G.tm_events')
eq('3', events[3].match)
eq(3, events[3].data.tabnr_old)
eq(2, events[3].data.tabnr_new)
eq({ tabnr_new = 2, tabnr_old = 3 }, events[3].data)
end)
it('does not trigger when a tab is moved to same position', function()
@@ -75,7 +71,7 @@ describe('TabMoved', function()
eq(0, eval('g:test'))
end)
it('responds correctly to mouse interactions on the tabline', function()
it('handles mouse interactions on the tabline', function()
local function setup()
Screen.new(25, 5)
command('set mouse=a')
@@ -96,7 +92,7 @@ describe('TabMoved', function()
api.nvim_input_mouse('left', 'press', '', 0, 0, 5)
api.nvim_input_mouse('left', 'release', '', 0, 0, 5)
poke_eventloop()
eq(0, #exec_lua('return _G.tm_events'))
eq({}, exec_lua('return _G.tm_events'))
clear()
-- dragging tab 1 to the right should trigger the event.
@@ -108,7 +104,6 @@ describe('TabMoved', function()
poke_eventloop()
local events = exec_lua('return _G.tm_events')
eq(1, #events)
eq(1, events[1].data.tabnr_old)
eq(2, events[1].data.tabnr_new)
eq({ tabnr_new = 2, tabnr_old = 1 }, events[1].data)
end)
end)