mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(api): ensure win_get_config() "border" is reciprocal (#34322)
fix(api): ensure win_get_config() is reciprocal Problem: win_get_config() does not include a 'none' border field, causing nvim_open_win() to apply the 'winborder' value. Solution: Include a 'none' border field in the returned config, such that it can be used reciprocally in nvim_open_win() to yield the same window layout.
This commit is contained in:
@@ -768,6 +768,8 @@ Dict(win_config) nvim_win_get_config(Window window, Arena *arena, Error *err)
|
|||||||
if (config->footer) {
|
if (config->footer) {
|
||||||
config_put_bordertext(&rv, config, kBorderTextFooter, arena);
|
config_put_bordertext(&rv, config, kBorderTextFooter, arena);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
PUT_KEY_X(rv, border, STRING_OBJ(cstr_as_string("none")));
|
||||||
}
|
}
|
||||||
} else if (!config->external) {
|
} else if (!config->external) {
|
||||||
PUT_KEY_X(rv, width, wp->w_width);
|
PUT_KEY_X(rv, width, wp->w_width);
|
||||||
|
@@ -1436,6 +1436,7 @@ describe('float window', function()
|
|||||||
local win = api.nvim_open_win(buf, false, { relative = 'editor', width = 20, height = 2, row = 3, col = 5, zindex = 60 })
|
local win = api.nvim_open_win(buf, false, { relative = 'editor', width = 20, height = 2, row = 3, col = 5, zindex = 60 })
|
||||||
local expected = {
|
local expected = {
|
||||||
anchor = 'NW',
|
anchor = 'NW',
|
||||||
|
border = 'none',
|
||||||
col = 5,
|
col = 5,
|
||||||
external = false,
|
external = false,
|
||||||
focusable = true,
|
focusable = true,
|
||||||
@@ -1473,7 +1474,7 @@ describe('float window', function()
|
|||||||
if multigrid then
|
if multigrid then
|
||||||
api.nvim_win_set_config(win, { external = true, width = 10, height = 1 })
|
api.nvim_win_set_config(win, { external = true, width = 10, height = 1 })
|
||||||
eq(
|
eq(
|
||||||
{ external = true, focusable = true, mouse = true, width = 10, height = 1, relative = '', hide = false },
|
{ external = true, focusable = true, mouse = true, width = 10, height = 1, relative = '', hide = false, border = 'none' },
|
||||||
api.nvim_win_get_config(win)
|
api.nvim_win_get_config(win)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@@ -1923,7 +1924,7 @@ describe('float window', function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
api.nvim_win_set_config(win, { border = 'none' })
|
api.nvim_win_set_config(win, { border = 'none' })
|
||||||
eq(nil, api.nvim_win_get_config(win).border)
|
eq('none', api.nvim_win_get_config(win).border)
|
||||||
|
|
||||||
api.nvim_win_set_config(win, { border = { '', '', '', '>', '', '', '', '<' } })
|
api.nvim_win_set_config(win, { border = { '', '', '', '>', '', '', '', '<' } })
|
||||||
eq({ '', '', '', '>', '', '', '', '<' }, api.nvim_win_get_config(win).border)
|
eq({ '', '', '', '>', '', '', '', '<' }, api.nvim_win_get_config(win).border)
|
||||||
@@ -4660,6 +4661,7 @@ describe('float window', function()
|
|||||||
height = 1,
|
height = 1,
|
||||||
bufpos = { 1, 32 },
|
bufpos = { 1, 32 },
|
||||||
anchor = 'NW',
|
anchor = 'NW',
|
||||||
|
border = 'none',
|
||||||
hide = false,
|
hide = false,
|
||||||
external = false,
|
external = false,
|
||||||
col = 0,
|
col = 0,
|
||||||
@@ -11443,7 +11445,7 @@ describe('float window', function()
|
|||||||
|
|
||||||
command('set winborder=none')
|
command('set winborder=none')
|
||||||
winid = api.nvim_open_win(buf, true, config)
|
winid = api.nvim_open_win(buf, true, config)
|
||||||
eq(nil, api.nvim_win_get_config(winid).border)
|
eq('none', api.nvim_win_get_config(winid).border)
|
||||||
command('fclose!')
|
command('fclose!')
|
||||||
|
|
||||||
-- respect config.border
|
-- respect config.border
|
||||||
|
Reference in New Issue
Block a user