mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(startup): make startup windows if there are only floating windows (#34349)
Problem: If user init creates a floating window, startup windows (e.g. to accomodate arglist files) are no longer created. Solution: Check that firstwin->w_next is not floating when deciding whether to make startup windows.
This commit is contained in:
@@ -1648,9 +1648,8 @@ static void create_windows(mparm_T *parmp)
|
|||||||
if (parmp->window_layout == WIN_TABS) {
|
if (parmp->window_layout == WIN_TABS) {
|
||||||
parmp->window_count = make_tabpages(parmp->window_count);
|
parmp->window_count = make_tabpages(parmp->window_count);
|
||||||
TIME_MSG("making tab pages");
|
TIME_MSG("making tab pages");
|
||||||
} else if (firstwin->w_next == NULL) {
|
} else if (firstwin->w_next == NULL || firstwin->w_next->w_floating) {
|
||||||
parmp->window_count = make_windows(parmp->window_count,
|
parmp->window_count = make_windows(parmp->window_count, parmp->window_layout == WIN_VER);
|
||||||
parmp->window_layout == WIN_VER);
|
|
||||||
TIME_MSG("making windows");
|
TIME_MSG("making windows");
|
||||||
} else {
|
} else {
|
||||||
parmp->window_count = win_count();
|
parmp->window_count = win_count();
|
||||||
|
@@ -761,7 +761,8 @@ describe('startup', function()
|
|||||||
\ 'row': 3,
|
\ 'row': 3,
|
||||||
\ 'col': 3
|
\ 'col': 3
|
||||||
\ }
|
\ }
|
||||||
autocmd WinEnter * let g:float_win = nvim_open_win(bufnr, v:false, config)]]
|
autocmd WinEnter * let g:float_win = nvim_open_win(bufnr, v:false, config)
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
finally(function()
|
finally(function()
|
||||||
os.remove('Xdiff.vim')
|
os.remove('Xdiff.vim')
|
||||||
@@ -774,6 +775,45 @@ describe('startup', function()
|
|||||||
eq(false, api.nvim_get_option_value('diff', { win = float_win }))
|
eq(false, api.nvim_get_option_value('diff', { win = float_win }))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('still opens arglist windows if init only opens floating windows', function()
|
||||||
|
write_file(
|
||||||
|
'Xfloat.vim',
|
||||||
|
[[
|
||||||
|
let config = {
|
||||||
|
\ 'relative': 'editor',
|
||||||
|
\ 'focusable': v:false,
|
||||||
|
\ 'width': 1,
|
||||||
|
\ 'height': 1,
|
||||||
|
\ 'row': 1,
|
||||||
|
\ 'col': 1
|
||||||
|
\ }
|
||||||
|
call nvim_open_win(0, v:false, config)
|
||||||
|
]]
|
||||||
|
)
|
||||||
|
finally(function()
|
||||||
|
os.remove('Xfloat.vim')
|
||||||
|
end)
|
||||||
|
clear { args = { '-u', 'Xfloat.vim', '-d', 'Xfloat.vim', 'foo' } }
|
||||||
|
local screen = Screen.new(40, 5)
|
||||||
|
screen:add_extra_attr_ids({
|
||||||
|
[101] = {
|
||||||
|
bold = true,
|
||||||
|
background = Screen.colors.LightBlue,
|
||||||
|
foreground = Screen.colors.Brown,
|
||||||
|
},
|
||||||
|
[102] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.LightBlue },
|
||||||
|
[103] = { foreground = Screen.colors.Magenta, background = Screen.colors.LightBlue },
|
||||||
|
[104] = { foreground = Screen.colors.DarkCyan, background = Screen.colors.LightBlue },
|
||||||
|
})
|
||||||
|
screen:expect([[
|
||||||
|
{7: }{101:^let}{22: config }{101:=}{22: }{102:{}{22: }│{23:-}|
|
||||||
|
{7: }{101:l}{22: }{102:\}{22: }{103:'relative'}{22:: }{103:'editor'}{22:, }│{23:-}|
|
||||||
|
{7: }{22: }{102:\}{22: }{103:'focusable'}{22:: }{104:v:}{22:false, }│ |
|
||||||
|
{3:Xfloat.vim }{2:<}|
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
it('does not crash if --embed is given twice', function()
|
it('does not crash if --embed is given twice', function()
|
||||||
clear { args = { '--embed' } }
|
clear { args = { '--embed' } }
|
||||||
assert_alive()
|
assert_alive()
|
||||||
@@ -788,20 +828,12 @@ describe('startup', function()
|
|||||||
it("sets 'shortmess' when loading other tabs", function()
|
it("sets 'shortmess' when loading other tabs", function()
|
||||||
clear({ args = { '-p', 'a', 'b', 'c' } })
|
clear({ args = { '-p', 'a', 'b', 'c' } })
|
||||||
local screen = Screen.new(25, 4)
|
local screen = Screen.new(25, 4)
|
||||||
screen:expect({
|
screen:expect([[
|
||||||
grid = [[
|
{5: a }{24: b c }{2: }{24:X}|
|
||||||
{1: a }{2: b c }{3: }{2:X}|
|
^ |
|
||||||
^ |
|
{1:~ }|
|
||||||
{4:~ }|
|
|
|
||||||
|
|
]])
|
||||||
]],
|
|
||||||
attr_ids = {
|
|
||||||
[1] = { bold = true },
|
|
||||||
[2] = { background = Screen.colors.LightGrey, underline = true },
|
|
||||||
[3] = { reverse = true },
|
|
||||||
[4] = { bold = true, foreground = Screen.colors.Blue1 },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -1476,20 +1508,18 @@ describe('inccommand on ex mode', function()
|
|||||||
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
|
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
|
||||||
})
|
})
|
||||||
fn.chansend(id, '%s/N')
|
fn.chansend(id, '%s/N')
|
||||||
screen:expect {
|
screen:add_extra_attr_ids({
|
||||||
grid = [[
|
[101] = {
|
||||||
{1:^ }|
|
background = Screen.colors.NvimDarkGrey2,
|
||||||
{1: }|*6
|
foreground = Screen.colors.NvimLightGrey2,
|
||||||
{1:Entering Ex mode. Type "visual" to go to Normal mode. }|
|
|
||||||
{1::%s/N }|
|
|
||||||
|
|
|
||||||
]],
|
|
||||||
attr_ids = {
|
|
||||||
[1] = {
|
|
||||||
background = Screen.colors.NvimDarkGrey2,
|
|
||||||
foreground = Screen.colors.NvimLightGrey2,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
|
screen:expect([[
|
||||||
|
{101:^ }|
|
||||||
|
{101: }|*6
|
||||||
|
{101:Entering Ex mode. Type "visual" to go to Normal mode. }|
|
||||||
|
{101::%s/N }|
|
||||||
|
|
|
||||||
|
]])
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user