mirror of
https://github.com/neovim/neovim
synced 2025-07-27 08:52:10 +00:00
fix(api): fix 'winborder' preventing splits with nvim_open_win (#32981)
While at it, rename the p_winbd variable to p_winborder, as 'winbd' is not the option's short name. Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@ -1273,13 +1273,18 @@ static bool parse_win_config(win_T *wp, Dict(win_config) *config, WinConfig *fco
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HAS_KEY_X(config, border) || *p_winbd != NUL) {
|
Object border_style = OBJECT_INIT;
|
||||||
|
if (HAS_KEY_X(config, border)) {
|
||||||
if (is_split) {
|
if (is_split) {
|
||||||
api_set_error(err, kErrorTypeValidation, "non-float cannot have 'border'");
|
api_set_error(err, kErrorTypeValidation, "non-float cannot have 'border'");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
Object style = config->border.type != kObjectTypeNil ? config->border : CSTR_AS_OBJ(p_winbd);
|
border_style = config->border;
|
||||||
parse_border_style(style, fconfig, err);
|
} else if (*p_winborder != NUL) {
|
||||||
|
border_style = CSTR_AS_OBJ(p_winborder);
|
||||||
|
}
|
||||||
|
if (border_style.type != kObjectTypeNil) {
|
||||||
|
parse_border_style(border_style, fconfig, err);
|
||||||
if (ERROR_SET(err)) {
|
if (ERROR_SET(err)) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -566,7 +566,7 @@ EXTERN OptInt p_wcm; ///< 'wildcharm'
|
|||||||
EXTERN int p_wic; ///< 'wildignorecase'
|
EXTERN int p_wic; ///< 'wildignorecase'
|
||||||
EXTERN char *p_wim; ///< 'wildmode'
|
EXTERN char *p_wim; ///< 'wildmode'
|
||||||
EXTERN int p_wmnu; ///< 'wildmenu'
|
EXTERN int p_wmnu; ///< 'wildmenu'
|
||||||
EXTERN char *p_winbd; ///< 'winborder'
|
EXTERN char *p_winborder; ///< 'winborder'
|
||||||
EXTERN OptInt p_wh; ///< 'winheight'
|
EXTERN OptInt p_wh; ///< 'winheight'
|
||||||
EXTERN OptInt p_wmh; ///< 'winminheight'
|
EXTERN OptInt p_wmh; ///< 'winminheight'
|
||||||
EXTERN OptInt p_wmw; ///< 'winminwidth'
|
EXTERN OptInt p_wmw; ///< 'winminwidth'
|
||||||
|
@ -10205,7 +10205,7 @@ local options = {
|
|||||||
scope = { 'global' },
|
scope = { 'global' },
|
||||||
short_desc = N_('border of floating window'),
|
short_desc = N_('border of floating window'),
|
||||||
type = 'string',
|
type = 'string',
|
||||||
varname = 'p_winbd',
|
varname = 'p_winborder',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
abbreviation = 'wi',
|
abbreviation = 'wi',
|
||||||
|
@ -1825,6 +1825,14 @@ describe('API/win', function()
|
|||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("can create split window when 'winborder' is set", function()
|
||||||
|
local old_win = api.nvim_get_current_win()
|
||||||
|
api.nvim_set_option_value('winborder', 'single', {})
|
||||||
|
local new_win = api.nvim_open_win(0, false, { split = 'right', win = 0 })
|
||||||
|
eq({ 'row', { { 'leaf', old_win }, { 'leaf', new_win } } }, fn.winlayout())
|
||||||
|
eq('', api.nvim_win_get_config(new_win).relative)
|
||||||
|
end)
|
||||||
|
|
||||||
describe("with 'autochdir'", function()
|
describe("with 'autochdir'", function()
|
||||||
local topdir
|
local topdir
|
||||||
local otherbuf
|
local otherbuf
|
||||||
|
Reference in New Issue
Block a user