fix(option): allow empty/blank edges in 'winborder' #40112

Problem:
The comma form of 'winborder' is split with copy_option_part(),
whose skip_to_option_part() eats spaces after a comma, and empty
fields are rejected.

Solution:
Split the comma form literally on ',', keeping empty fields and
single-space fields.
This commit is contained in:
glepnir
2026-06-05 18:37:07 +08:00
committed by GitHub
parent e887cfb3b5
commit 11b9e6f193
5 changed files with 38 additions and 26 deletions

View File

@@ -11478,8 +11478,18 @@ describe('float window', function()
winid = api.nvim_open_win(buf, false, config)
eq('', api.nvim_win_get_config(winid).border[1])
-- Single-space border char.
command([[lua vim.opt.winborder=",,, ,,,, "]])
winid = api.nvim_open_win(buf, false, config)
eq({ '', '', '', ' ', '', '', '', ' ' }, api.nvim_win_get_config(winid).border)
-- Trailing comma hides the last side
command([[set winborder=+,-,+,\|,+,-,+,]])
winid = api.nvim_open_win(buf, false, config)
eq({ '+', '-', '+', '|', '+', '-', '+', '' }, api.nvim_win_get_config(winid).border)
command('fclose!')
eq('Vim(set):E474: Invalid argument: winborder=,,', pcall_err(command, 'set winborder=,,'))
eq('Vim(set):E474: Invalid argument: winborder=+,-,+,|,+,-,+,', pcall_err(command, [[set winborder=+,-,+,\|,+,-,+,]]))
eq('Vim(set):E474: Invalid argument: winborder=custom', pcall_err(command, 'set winborder=custom'))
end)