diff options
Diffstat (limited to 'test/functional/autocmd/tabnewentered_spec.lua')
-rw-r--r-- | test/functional/autocmd/tabnewentered_spec.lua | 483 |
1 files changed, 299 insertions, 184 deletions
diff --git a/test/functional/autocmd/tabnewentered_spec.lua b/test/functional/autocmd/tabnewentered_spec.lua index 6e167dd55c..fd4a16a298 100644 --- a/test/functional/autocmd/tabnewentered_spec.lua +++ b/test/functional/autocmd/tabnewentered_spec.lua @@ -15,16 +15,16 @@ describe('TabNewEntered', function() it('matches when entering any new tab', function() clear() nvim('command', 'au! TabNewEntered * echom "tabnewentered:".tabpagenr().":".bufnr("")') - eq("tabnewentered:2:2", nvim('exec', 'tabnew', true)) - eq("tabnewentered:3:3", nvim('exec', 'tabnew test.x2', true)) - end) + eq('tabnewentered:2:2', nvim('exec', 'tabnew', true)) + eq('tabnewentered:3:3', nvim('exec', 'tabnew test.x2', true)) + end) end) describe('with FILE as <afile>', function() it('matches when opening a new tab for FILE', function() clear() nvim('command', 'au! TabNewEntered Xtest-tabnewentered echom "tabnewentered:match"') eq('tabnewentered:match', nvim('exec', 'tabnew Xtest-tabnewentered', true)) - end) + end) end) describe('with CTRL-W T', function() it('works when opening a new tab with CTRL-W T', function() @@ -49,22 +49,22 @@ end) describe('TabEnter', function() before_each(clear) it('has correct previous tab when entering any new tab', function() - command('augroup TEMP') - nvim('command', 'au! TabEnter * echom "tabenter:".tabpagenr().":".tabpagenr(\'#\')') - command('augroup END') - eq("tabenter:2:1", nvim('exec', 'tabnew', true)) - eq("tabenter:3:2", nvim('exec', 'tabnew test.x2', true)) - command('augroup! TEMP') + command('augroup TEMP') + nvim('command', 'au! TabEnter * echom "tabenter:".tabpagenr().":".tabpagenr(\'#\')') + command('augroup END') + eq('tabenter:2:1', nvim('exec', 'tabnew', true)) + eq('tabenter:3:2', nvim('exec', 'tabnew test.x2', true)) + command('augroup! TEMP') end) it('has correct previous tab when entering any preexisting tab', function() - command('tabnew') - command('tabnew') - command('augroup TEMP') - nvim('command', 'au! TabEnter * echom "tabenter:".tabpagenr().":".tabpagenr(\'#\')') - command('augroup END') - eq("tabenter:1:3", nvim('exec', 'tabnext', true)) - eq("tabenter:2:1", nvim('exec', 'tabnext', true)) - command('augroup! TEMP') + command('tabnew') + command('tabnew') + command('augroup TEMP') + nvim('command', 'au! TabEnter * echom "tabenter:".tabpagenr().":".tabpagenr(\'#\')') + command('augroup END') + eq('tabenter:1:3', nvim('exec', 'tabnext', true)) + eq('tabenter:2:1', nvim('exec', 'tabnext', true)) + command('augroup! TEMP') end) end) @@ -72,18 +72,19 @@ describe('tabpage/previous', function() before_each(clear) local function switches_to_previous_after_new_tab_creation_at_end(characters) return function() - -- Add three tabs for a total of four - command('tabnew') - command('tabnew') - command('tabnew') + -- Add three tabs for a total of four + command('tabnew') + command('tabnew') + command('tabnew') - -- The previous tab is now the third. - eq(3, eval('tabpagenr(\'#\')')) + -- The previous tab is now the third. + eq(3, eval("tabpagenr('#')")) - -- Switch to the previous (third) tab - feed(characters) + -- Switch to the previous (third) tab + feed(characters) - eq(dedent([=[ + eq( + dedent([=[ Tab page 1 [No Name] @@ -93,18 +94,29 @@ describe('tabpage/previous', function() > [No Name] Tab page 4 # [No Name]]=]), - exec_capture('tabs') - ) + exec_capture('tabs') + ) - -- The previous tab is now the fourth. - eq(4, eval('tabpagenr(\'#\')')) + -- The previous tab is now the fourth. + eq(4, eval("tabpagenr('#')")) end end - it('switches to previous via g<Tab> after new tab creation at end', - switches_to_previous_after_new_tab_creation_at_end('g<Tab>')) - it('switches to previous via <C-W>g<Tab>. after new tab creation at end', switches_to_previous_after_new_tab_creation_at_end('<C-W>g<Tab>')) - it('switches to previous via <C-Tab>. after new tab creation at end', switches_to_previous_after_new_tab_creation_at_end('<C-Tab>')) - it('switches to previous via :tabn #<CR>. after new tab creation at end', switches_to_previous_after_new_tab_creation_at_end(':tabn #<CR>')) + it( + 'switches to previous via g<Tab> after new tab creation at end', + switches_to_previous_after_new_tab_creation_at_end('g<Tab>') + ) + it( + 'switches to previous via <C-W>g<Tab>. after new tab creation at end', + switches_to_previous_after_new_tab_creation_at_end('<C-W>g<Tab>') + ) + it( + 'switches to previous via <C-Tab>. after new tab creation at end', + switches_to_previous_after_new_tab_creation_at_end('<C-Tab>') + ) + it( + 'switches to previous via :tabn #<CR>. after new tab creation at end', + switches_to_previous_after_new_tab_creation_at_end(':tabn #<CR>') + ) local function switches_to_previous_after_new_tab_creation_in_middle(characters) return function() @@ -118,11 +130,12 @@ describe('tabpage/previous', function() command('tabnew') -- The previous tab is now the second. - eq(2, eval('tabpagenr(\'#\')')) + eq(2, eval("tabpagenr('#')")) -- Switch to the previous (second) tab feed(characters) - eq(dedent([=[ + eq( + dedent([=[ Tab page 1 [No Name] @@ -134,21 +147,29 @@ describe('tabpage/previous', function() [No Name] Tab page 5 [No Name]]=]), - exec_capture('tabs') + exec_capture('tabs') ) -- The previous tab is now the third. - eq(3, eval('tabpagenr(\'#\')')) + eq(3, eval("tabpagenr('#')")) end end - it('switches to previous via g<Tab> after new tab creation in middle', - switches_to_previous_after_new_tab_creation_in_middle('g<Tab>')) - it('switches to previous via <C-W>g<Tab> after new tab creation in middle', - switches_to_previous_after_new_tab_creation_in_middle('<C-W>g<Tab>')) - it('switches to previous via <C-Tab> after new tab creation in middle', - switches_to_previous_after_new_tab_creation_in_middle('<C-Tab>')) - it('switches to previous via :tabn #<CR> after new tab creation in middle', - switches_to_previous_after_new_tab_creation_in_middle(':tabn #<CR>')) + it( + 'switches to previous via g<Tab> after new tab creation in middle', + switches_to_previous_after_new_tab_creation_in_middle('g<Tab>') + ) + it( + 'switches to previous via <C-W>g<Tab> after new tab creation in middle', + switches_to_previous_after_new_tab_creation_in_middle('<C-W>g<Tab>') + ) + it( + 'switches to previous via <C-Tab> after new tab creation in middle', + switches_to_previous_after_new_tab_creation_in_middle('<C-Tab>') + ) + it( + 'switches to previous via :tabn #<CR> after new tab creation in middle', + switches_to_previous_after_new_tab_creation_in_middle(':tabn #<CR>') + ) local function switches_to_previous_after_switching_to_next_tab(characters) return function() @@ -160,12 +181,13 @@ describe('tabpage/previous', function() command('tabnext') -- The previous tab is now the fourth. - eq(4, eval('tabpagenr(\'#\')')) + eq(4, eval("tabpagenr('#')")) -- Switch to the previous (fourth) tab feed(characters) - eq(dedent([=[ + eq( + dedent([=[ Tab page 1 # [No Name] @@ -175,21 +197,29 @@ describe('tabpage/previous', function() [No Name] Tab page 4 > [No Name]]=]), - exec_capture('tabs') + exec_capture('tabs') ) -- The previous tab is now the first. - eq(1, eval('tabpagenr(\'#\')')) + eq(1, eval("tabpagenr('#')")) end end - it('switches to previous via g<Tab> after switching to next tab', - switches_to_previous_after_switching_to_next_tab('g<Tab>')) - it('switches to previous via <C-W>g<Tab> after switching to next tab', - switches_to_previous_after_switching_to_next_tab('<C-W>g<Tab>')) - it('switches to previous via <C-Tab> after switching to next tab', - switches_to_previous_after_switching_to_next_tab('<C-Tab>')) - it('switches to previous via :tabn #<CR> after switching to next tab', - switches_to_previous_after_switching_to_next_tab(':tabn #<CR>')) + it( + 'switches to previous via g<Tab> after switching to next tab', + switches_to_previous_after_switching_to_next_tab('g<Tab>') + ) + it( + 'switches to previous via <C-W>g<Tab> after switching to next tab', + switches_to_previous_after_switching_to_next_tab('<C-W>g<Tab>') + ) + it( + 'switches to previous via <C-Tab> after switching to next tab', + switches_to_previous_after_switching_to_next_tab('<C-Tab>') + ) + it( + 'switches to previous via :tabn #<CR> after switching to next tab', + switches_to_previous_after_switching_to_next_tab(':tabn #<CR>') + ) local function switches_to_previous_after_switching_to_last_tab(characters) return function() @@ -203,12 +233,13 @@ describe('tabpage/previous', function() command('tablast') -- The previous tab is now the second. - eq(1, eval('tabpagenr(\'#\')')) + eq(1, eval("tabpagenr('#')")) -- Switch to the previous (second) tab feed(characters) - eq(dedent([=[ + eq( + dedent([=[ Tab page 1 > [No Name] @@ -218,21 +249,29 @@ describe('tabpage/previous', function() [No Name] Tab page 4 # [No Name]]=]), - exec_capture('tabs') + exec_capture('tabs') ) -- The previous tab is now the fourth. - eq(4, eval('tabpagenr(\'#\')')) + eq(4, eval("tabpagenr('#')")) end end - it('switches to previous after switching to last tab', - switches_to_previous_after_switching_to_last_tab('g<Tab>')) - it('switches to previous after switching to last tab', - switches_to_previous_after_switching_to_last_tab('<C-W>g<Tab>')) - it('switches to previous after switching to last tab', - switches_to_previous_after_switching_to_last_tab('<C-Tab>')) - it('switches to previous after switching to last tab', - switches_to_previous_after_switching_to_last_tab(':tabn #<CR>')) + it( + 'switches to previous after switching to last tab', + switches_to_previous_after_switching_to_last_tab('g<Tab>') + ) + it( + 'switches to previous after switching to last tab', + switches_to_previous_after_switching_to_last_tab('<C-W>g<Tab>') + ) + it( + 'switches to previous after switching to last tab', + switches_to_previous_after_switching_to_last_tab('<C-Tab>') + ) + it( + 'switches to previous after switching to last tab', + switches_to_previous_after_switching_to_last_tab(':tabn #<CR>') + ) local function switches_to_previous_after_switching_to_previous_tab(characters) return function() @@ -244,12 +283,13 @@ describe('tabpage/previous', function() command('tabprevious') -- The previous tab is now the fourth. - eq(4, eval('tabpagenr(\'#\')')) + eq(4, eval("tabpagenr('#')")) -- Switch to the previous (fourth) tab feed(characters) - eq(dedent([=[ + eq( + dedent([=[ Tab page 1 [No Name] @@ -259,21 +299,29 @@ describe('tabpage/previous', function() # [No Name] Tab page 4 > [No Name]]=]), - exec_capture('tabs') + exec_capture('tabs') ) -- The previous tab is now the third. - eq(3, eval('tabpagenr(\'#\')')) + eq(3, eval("tabpagenr('#')")) end end - it('switches to previous via g<Tab> after switching to previous tab', - switches_to_previous_after_switching_to_previous_tab('g<Tab>')) - it('switches to previous via <C-W>g<Tab> after switching to previous tab', - switches_to_previous_after_switching_to_previous_tab('<C-W>g<Tab>')) - it('switches to previous via <C-Tab> after switching to previous tab', - switches_to_previous_after_switching_to_previous_tab('<C-Tab>')) - it('switches to previous via :tabn #<CR> after switching to previous tab', - switches_to_previous_after_switching_to_previous_tab(':tabn #<CR>')) + it( + 'switches to previous via g<Tab> after switching to previous tab', + switches_to_previous_after_switching_to_previous_tab('g<Tab>') + ) + it( + 'switches to previous via <C-W>g<Tab> after switching to previous tab', + switches_to_previous_after_switching_to_previous_tab('<C-W>g<Tab>') + ) + it( + 'switches to previous via <C-Tab> after switching to previous tab', + switches_to_previous_after_switching_to_previous_tab('<C-Tab>') + ) + it( + 'switches to previous via :tabn #<CR> after switching to previous tab', + switches_to_previous_after_switching_to_previous_tab(':tabn #<CR>') + ) local function switches_to_previous_after_switching_to_first_tab(characters) return function() @@ -287,12 +335,13 @@ describe('tabpage/previous', function() command('tabfirst') -- The previous tab is now the third. - eq(3, eval('tabpagenr(\'#\')')) + eq(3, eval("tabpagenr('#')")) -- Switch to the previous (third) tab feed(characters) - eq(dedent([=[ + eq( + dedent([=[ Tab page 1 # [No Name] @@ -302,21 +351,29 @@ describe('tabpage/previous', function() > [No Name] Tab page 4 [No Name]]=]), - exec_capture('tabs') + exec_capture('tabs') ) -- The previous tab is now the first. - eq(1, eval('tabpagenr(\'#\')')) + eq(1, eval("tabpagenr('#')")) end end - it('switches to previous via g<Tab> after switching to first tab', - switches_to_previous_after_switching_to_first_tab('g<Tab>')) - it('switches to previous via <C-W>g<Tab> after switching to first tab', - switches_to_previous_after_switching_to_first_tab('<C-W>g<Tab>')) - it('switches to previous via <C-Tab> after switching to first tab', - switches_to_previous_after_switching_to_first_tab('<C-Tab>')) - it('switches to previous via :tabn #<CR> after switching to first tab', - switches_to_previous_after_switching_to_first_tab(':tabn #<CR>')) + it( + 'switches to previous via g<Tab> after switching to first tab', + switches_to_previous_after_switching_to_first_tab('g<Tab>') + ) + it( + 'switches to previous via <C-W>g<Tab> after switching to first tab', + switches_to_previous_after_switching_to_first_tab('<C-W>g<Tab>') + ) + it( + 'switches to previous via <C-Tab> after switching to first tab', + switches_to_previous_after_switching_to_first_tab('<C-Tab>') + ) + it( + 'switches to previous via :tabn #<CR> after switching to first tab', + switches_to_previous_after_switching_to_first_tab(':tabn #<CR>') + ) local function switches_to_previous_after_numbered_tab_switch(characters) return function() @@ -328,12 +385,13 @@ describe('tabpage/previous', function() command('tabnext 2') -- The previous tab is now the fourth. - eq(4, eval('tabpagenr(\'#\')')) + eq(4, eval("tabpagenr('#')")) -- Switch to the previous (fourth) tab feed(characters) - eq(dedent([=[ + eq( + dedent([=[ Tab page 1 [No Name] @@ -343,21 +401,29 @@ describe('tabpage/previous', function() [No Name] Tab page 4 > [No Name]]=]), - exec_capture('tabs') + exec_capture('tabs') ) -- The previous tab is now the second. - eq(2, eval('tabpagenr(\'#\')')) + eq(2, eval("tabpagenr('#')")) end end - it('switches to previous via g<Tab> after numbered tab switch', - switches_to_previous_after_numbered_tab_switch('g<Tab>')) - it('switches to previous via <C-W>g<Tab> after numbered tab switch', - switches_to_previous_after_numbered_tab_switch('<C-W>g<Tab>')) - it('switches to previous via <C-Tab> after numbered tab switch', - switches_to_previous_after_numbered_tab_switch('<C-Tab>')) - it('switches to previous via :tabn #<CR> after numbered tab switch', - switches_to_previous_after_numbered_tab_switch(':tabn #<CR>')) + it( + 'switches to previous via g<Tab> after numbered tab switch', + switches_to_previous_after_numbered_tab_switch('g<Tab>') + ) + it( + 'switches to previous via <C-W>g<Tab> after numbered tab switch', + switches_to_previous_after_numbered_tab_switch('<C-W>g<Tab>') + ) + it( + 'switches to previous via <C-Tab> after numbered tab switch', + switches_to_previous_after_numbered_tab_switch('<C-Tab>') + ) + it( + 'switches to previous via :tabn #<CR> after numbered tab switch', + switches_to_previous_after_numbered_tab_switch(':tabn #<CR>') + ) local function switches_to_previous_after_switching_to_previous(characters1, characters2) return function() @@ -371,12 +437,13 @@ describe('tabpage/previous', function() feed(characters1) -- The previous tab is now the second. - eq(2, eval('tabpagenr(\'#\')')) + eq(2, eval("tabpagenr('#')")) -- Switch to the previous (second) tab feed(characters2) - eq(dedent([=[ + eq( + dedent([=[ Tab page 1 [No Name] @@ -386,45 +453,77 @@ describe('tabpage/previous', function() [No Name] Tab page 4 # [No Name]]=]), - exec_capture('tabs') + exec_capture('tabs') ) -- The previous tab is now the fourth. - eq(4, eval('tabpagenr(\'#\')')) + eq(4, eval("tabpagenr('#')")) end end - it('switches to previous via g<Tab> after switching to previous via g<Tab>', - switches_to_previous_after_switching_to_previous('g<Tab>', 'g<Tab>')) - it('switches to previous via <C-W>g<Tab> after switching to previous via g<Tab>', - switches_to_previous_after_switching_to_previous('g<Tab>', '<C-W>g<Tab>')) - it('switches to previous via <C-Tab> after switching to previous via g<Tab>', - switches_to_previous_after_switching_to_previous('g<Tab>', '<C-Tab>')) - it('switches to previous via :tabn #<CR> after switching to previous via g<Tab>', - switches_to_previous_after_switching_to_previous('g<Tab>', ':tabn #<CR>')) - it('switches to previous via g<Tab> after switching to previous via <C-W>g<Tab>', - switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', 'g<Tab>')) - it('switches to previous via <C-W>g<Tab> after switching to previous via <C-W>g<Tab>', - switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', '<C-W>g<Tab>')) - it('switches to previous via <C-Tab> after switching to previous via <C-W>g<Tab>', - switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', '<C-Tab>')) - it('switches to previous via :tabn #<CR> after switching to previous via <C-W>g<Tab>', - switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', ':tabn #<CR>')) - it('switches to previous via g<Tab> after switching to previous via <C-Tab>', - switches_to_previous_after_switching_to_previous('<C-Tab>', 'g<Tab>')) - it('switches to previous via <C-W>g<Tab> after switching to previous via <C-Tab>', - switches_to_previous_after_switching_to_previous('<C-Tab>', '<C-W>g<Tab>')) - it('switches to previous via <C-Tab> after switching to previous via <C-Tab>', - switches_to_previous_after_switching_to_previous('<C-Tab>', '<C-Tab>')) - it('switches to previous via :tabn #<CR> after switching to previous via <C-Tab>', - switches_to_previous_after_switching_to_previous('<C-Tab>', ':tabn #<CR>')) - it('switches to previous via g<Tab> after switching to previous via :tabn #<CR>', - switches_to_previous_after_switching_to_previous(':tabn #<CR>', 'g<Tab>')) - it('switches to previous via <C-W>g<Tab> after switching to previous via :tabn #<CR>', - switches_to_previous_after_switching_to_previous(':tabn #<CR>', '<C-W>g<Tab>')) - it('switches to previous via <C-Tab> after switching to previous via <C-Tab>', - switches_to_previous_after_switching_to_previous(':tabn #<CR>', '<C-Tab>')) - it('switches to previous via :tabn #<CR> after switching to previous via :tabn #<CR>', - switches_to_previous_after_switching_to_previous(':tabn #<CR>', ':tabn #<CR>')) + it( + 'switches to previous via g<Tab> after switching to previous via g<Tab>', + switches_to_previous_after_switching_to_previous('g<Tab>', 'g<Tab>') + ) + it( + 'switches to previous via <C-W>g<Tab> after switching to previous via g<Tab>', + switches_to_previous_after_switching_to_previous('g<Tab>', '<C-W>g<Tab>') + ) + it( + 'switches to previous via <C-Tab> after switching to previous via g<Tab>', + switches_to_previous_after_switching_to_previous('g<Tab>', '<C-Tab>') + ) + it( + 'switches to previous via :tabn #<CR> after switching to previous via g<Tab>', + switches_to_previous_after_switching_to_previous('g<Tab>', ':tabn #<CR>') + ) + it( + 'switches to previous via g<Tab> after switching to previous via <C-W>g<Tab>', + switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', 'g<Tab>') + ) + it( + 'switches to previous via <C-W>g<Tab> after switching to previous via <C-W>g<Tab>', + switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', '<C-W>g<Tab>') + ) + it( + 'switches to previous via <C-Tab> after switching to previous via <C-W>g<Tab>', + switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', '<C-Tab>') + ) + it( + 'switches to previous via :tabn #<CR> after switching to previous via <C-W>g<Tab>', + switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', ':tabn #<CR>') + ) + it( + 'switches to previous via g<Tab> after switching to previous via <C-Tab>', + switches_to_previous_after_switching_to_previous('<C-Tab>', 'g<Tab>') + ) + it( + 'switches to previous via <C-W>g<Tab> after switching to previous via <C-Tab>', + switches_to_previous_after_switching_to_previous('<C-Tab>', '<C-W>g<Tab>') + ) + it( + 'switches to previous via <C-Tab> after switching to previous via <C-Tab>', + switches_to_previous_after_switching_to_previous('<C-Tab>', '<C-Tab>') + ) + it( + 'switches to previous via :tabn #<CR> after switching to previous via <C-Tab>', + switches_to_previous_after_switching_to_previous('<C-Tab>', ':tabn #<CR>') + ) + it( + 'switches to previous via g<Tab> after switching to previous via :tabn #<CR>', + switches_to_previous_after_switching_to_previous(':tabn #<CR>', 'g<Tab>') + ) + it( + 'switches to previous via <C-W>g<Tab> after switching to previous via :tabn #<CR>', + switches_to_previous_after_switching_to_previous(':tabn #<CR>', '<C-W>g<Tab>') + ) + it( + 'switches to previous via <C-Tab> after switching to previous via <C-Tab>', + switches_to_previous_after_switching_to_previous(':tabn #<CR>', '<C-Tab>') + ) + it( + 'switches to previous via :tabn #<CR> after switching to previous via :tabn #<CR>', + switches_to_previous_after_switching_to_previous(':tabn #<CR>', ':tabn #<CR>') + ) local function does_not_switch_to_previous_after_closing_current_tab(characters) return function() @@ -436,13 +535,14 @@ describe('tabpage/previous', function() command('wincmd c') -- The previous tab is now the "zeroth" -- there isn't one. - eq(0, eval('tabpagenr(\'#\')')) + eq(0, eval("tabpagenr('#')")) -- At this point, switching to the "previous" (i.e. fourth) tab would mean -- switching to either a dangling or a null pointer. feed(characters) - eq(dedent([=[ + eq( + dedent([=[ Tab page 1 [No Name] @@ -450,21 +550,29 @@ describe('tabpage/previous', function() [No Name] Tab page 3 > [No Name]]=]), - exec_capture('tabs') + exec_capture('tabs') ) -- The previous tab is now the "zero". - eq(0, eval('tabpagenr(\'#\')')) + eq(0, eval("tabpagenr('#')")) end end - it('does not switch to previous via g<Tab> after closing current tab', - does_not_switch_to_previous_after_closing_current_tab('g<Tab>')) - it('does not switch to previous via <C-W>g<Tab> after closing current tab', - does_not_switch_to_previous_after_closing_current_tab('<C-W>g<Tab>')) - it('does not switch to previous via <C-Tab> after closing current tab', - does_not_switch_to_previous_after_closing_current_tab('<C-Tab>')) - it('does not switch to previous via :tabn #<CR> after closing current tab', - does_not_switch_to_previous_after_closing_current_tab(':tabn #<CR>')) + it( + 'does not switch to previous via g<Tab> after closing current tab', + does_not_switch_to_previous_after_closing_current_tab('g<Tab>') + ) + it( + 'does not switch to previous via <C-W>g<Tab> after closing current tab', + does_not_switch_to_previous_after_closing_current_tab('<C-W>g<Tab>') + ) + it( + 'does not switch to previous via <C-Tab> after closing current tab', + does_not_switch_to_previous_after_closing_current_tab('<C-Tab>') + ) + it( + 'does not switch to previous via :tabn #<CR> after closing current tab', + does_not_switch_to_previous_after_closing_current_tab(':tabn #<CR>') + ) local function does_not_switch_to_previous_after_entering_operator_pending(characters) return function() @@ -474,7 +582,7 @@ describe('tabpage/previous', function() command('tabnew') -- The previous tab is now the third. - eq(3, eval('tabpagenr(\'#\')')) + eq(3, eval("tabpagenr('#')")) -- Enter operator pending mode. feed('d') @@ -491,11 +599,13 @@ describe('tabpage/previous', function() eq(4, eval('tabpagenr()')) -- The previous tab is still the third. - eq(3, eval('tabpagenr(\'#\')')) + eq(3, eval("tabpagenr('#')")) end end - it('does not switch to previous via g<Tab> after entering operator pending', - does_not_switch_to_previous_after_entering_operator_pending('g<Tab>')) + it( + 'does not switch to previous via g<Tab> after entering operator pending', + does_not_switch_to_previous_after_entering_operator_pending('g<Tab>') + ) -- NOTE: When in operator pending mode, attempting to switch to previous has -- the following effect: -- - Ctrl-W exits operator pending mode @@ -506,8 +616,10 @@ describe('tabpage/previous', function() -- be the same as the normal mode command to switch to the previous tab. -- it('does not switch to previous via <C-W>g<Tab> after entering operator pending', -- does_not_switch_to_previous_after_entering_operator_pending('<C-W>g<Tab>')) - it('does not switch to previous via <C-Tab> after entering operator pending', - does_not_switch_to_previous_after_entering_operator_pending('<C-Tab>')) + it( + 'does not switch to previous via <C-Tab> after entering operator pending', + does_not_switch_to_previous_after_entering_operator_pending('<C-Tab>') + ) -- NOTE: When in operator pending mode, pressing : leaves operator pending -- mode and enters command mode, so :tabn #<CR> does in fact switch -- tabs. @@ -522,7 +634,7 @@ describe('tabpage/previous', function() command('tabnew') -- The previous tab is now the third. - eq(3, eval('tabpagenr(\'#\')')) + eq(3, eval("tabpagenr('#')")) -- Edit : command line in command-line window feed('q:') @@ -540,31 +652,34 @@ describe('tabpage/previous', function() eq(4, eval('tabpagenr()')) -- The previous tab is still the third. - eq(3, eval('tabpagenr(\'#\')')) + eq(3, eval("tabpagenr('#')")) end end - it('cmdline-win prevents tab switch via g<Tab>', - cmdline_win_prevents_tab_switch('g<Tab>', 0)) - it('cmdline-win prevents tab switch via <C-W>g<Tab>', - cmdline_win_prevents_tab_switch('<C-W>g<Tab>', 1)) - it('cmdline-win prevents tab switch via <C-Tab>', - cmdline_win_prevents_tab_switch('<C-Tab>', 0)) - it('cmdline-win prevents tab switch via :tabn #<CR>', - cmdline_win_prevents_tab_switch(':tabn #<CR>', 0)) + it('cmdline-win prevents tab switch via g<Tab>', cmdline_win_prevents_tab_switch('g<Tab>', 0)) + it( + 'cmdline-win prevents tab switch via <C-W>g<Tab>', + cmdline_win_prevents_tab_switch('<C-W>g<Tab>', 1) + ) + it('cmdline-win prevents tab switch via <C-Tab>', cmdline_win_prevents_tab_switch('<C-Tab>', 0)) + it( + 'cmdline-win prevents tab switch via :tabn #<CR>', + cmdline_win_prevents_tab_switch(':tabn #<CR>', 0) + ) it(':tabs indicates correct prevtab curwin', function() - -- Add three tabs for a total of four - command('tabnew') - command('tabnew') - command('split') - command('vsplit') - feed('<C-w>p') - command('tabnew') + -- Add three tabs for a total of four + command('tabnew') + command('tabnew') + command('split') + command('vsplit') + feed('<C-w>p') + command('tabnew') - -- The previous tab is now the three. - eq(3, eval('tabpagenr(\'#\')')) + -- The previous tab is now the three. + eq(3, eval("tabpagenr('#')")) - eq(dedent([=[ + eq( + dedent([=[ Tab page 1 [No Name] @@ -576,7 +691,7 @@ describe('tabpage/previous', function() [No Name] Tab page 4 > [No Name]]=]), - exec_capture('tabs') - ) + exec_capture('tabs') + ) end) end) |