mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
commit
204f557a11
@ -251,11 +251,14 @@ newwindow:
|
|||||||
if (win_new_tabpage((int)Prenum, NULL) == OK
|
if (win_new_tabpage((int)Prenum, NULL) == OK
|
||||||
&& valid_tabpage(oldtab)) {
|
&& valid_tabpage(oldtab)) {
|
||||||
newtab = curtab;
|
newtab = curtab;
|
||||||
goto_tabpage_tp(oldtab, TRUE, TRUE);
|
goto_tabpage_tp(oldtab, true, true);
|
||||||
if (curwin == wp)
|
if (curwin == wp) {
|
||||||
win_close(curwin, FALSE);
|
win_close(curwin, false);
|
||||||
if (valid_tabpage(newtab))
|
}
|
||||||
goto_tabpage_tp(newtab, TRUE, TRUE);
|
if (valid_tabpage(newtab)) {
|
||||||
|
goto_tabpage_tp(newtab, true, true);
|
||||||
|
apply_autocmds(EVENT_TABNEWENTERED, NULL, NULL, false, curbuf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2,21 +2,30 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq
|
local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq
|
||||||
|
|
||||||
describe('TabNewEntered', function()
|
describe('TabNewEntered', function()
|
||||||
describe('au TabNewEntered', function()
|
describe('au TabNewEntered', function()
|
||||||
describe('with * as <afile>', function()
|
describe('with * as <afile>', function()
|
||||||
it('matches when entering any new tab', function()
|
it('matches when entering any new tab', function()
|
||||||
clear()
|
clear()
|
||||||
nvim('command', 'au! TabNewEntered * echom "tabnewentered:".tabpagenr().":".bufnr("")')
|
nvim('command', 'au! TabNewEntered * echom "tabnewentered:".tabpagenr().":".bufnr("")')
|
||||||
eq("\ntabnewentered:2:2", nvim('command_output', 'tabnew'))
|
eq("\ntabnewentered:2:2", nvim('command_output', 'tabnew'))
|
||||||
eq("\n\"test.x2\" [New File]\ntabnewentered:3:3", nvim('command_output', 'tabnew test.x2'))
|
eq("\n\"test.x2\" [New File]\ntabnewentered:3:3", nvim('command_output', 'tabnew test.x2'))
|
||||||
end)
|
end)
|
||||||
end)
|
|
||||||
describe('with FILE as <afile>', function()
|
|
||||||
it('matches when opening a new tab for FILE', function()
|
|
||||||
local tmp_path = nvim('eval', 'tempname()')
|
|
||||||
nvim('command', 'au! TabNewEntered '..tmp_path..' echom "tabnewentered:match"')
|
|
||||||
eq("\n\""..tmp_path.."\" [New File]\ntabnewentered:4:4\ntabnewentered:match", nvim('command_output', 'tabnew '..tmp_path))
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
describe('with FILE as <afile>', function()
|
||||||
|
it('matches when opening a new tab for FILE', function()
|
||||||
|
local tmp_path = nvim('eval', 'tempname()')
|
||||||
|
nvim('command', 'au! TabNewEntered '..tmp_path..' echom "tabnewentered:match"')
|
||||||
|
eq("\n\""..tmp_path.."\" [New File]\ntabnewentered:4:4\ntabnewentered:match", nvim('command_output', 'tabnew '..tmp_path))
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
describe('with CTRL-W T', function()
|
||||||
|
it('works when opening a new tab with CTRL-W T', function()
|
||||||
|
clear()
|
||||||
|
nvim('command', 'au! TabNewEntered * echom "entered"')
|
||||||
|
nvim('command', 'tabnew test.x2')
|
||||||
|
nvim('command', 'split')
|
||||||
|
eq('\nentered', nvim('command_output', 'execute "normal \\<C-W>T"'))
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user