diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index b7ad960377..cfd6a70a00 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1166,9 +1166,10 @@ TabLeave Just before leaving a |tabpage|. After WinLeave. *TabMoved* -TabMoved After a |tabpage| is moved. - See |:tabmove|. expands to the - affected |tabpage-number| before the move. +TabMoved After a |tabpage| is moved (by |:tabmove| or + mouse drag). 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. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index d2b695f023..ddccadd63d 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -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 diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index 8f578de3f0..a11dfe1cc5 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -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. ============================================================================== diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index ff2884b267..a7c7474ec6 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -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. diff --git a/src/gen/gen_eval_files.lua b/src/gen/gen_eval_files.lua index 5cc9e6a99c..cd6df9a891 100755 --- a/src/gen/gen_eval_files.lua +++ b/src/gen/gen_eval_files.lua @@ -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 diff --git a/src/nvim/option.c b/src/nvim/option.c index 01d1c35fbf..bd9ad6fe91 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -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. diff --git a/test/functional/autocmd/tabmove_spec.lua b/test/functional/autocmd/tabmove_spec.lua index ca5ed02b1d..ba01111fb3 100644 --- a/test/functional/autocmd/tabmove_spec.lua +++ b/test/functional/autocmd/tabmove_spec.lua @@ -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 and event-data fields', function() + it('sets , 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)