fix(ui): set stc to empty in floatwin with minimal style (#21720)

fix(ui): set stc to emtpy in floatwin with minimal style
This commit is contained in:
Raphael 2023-01-10 17:36:48 +08:00 committed by GitHub
parent 1df2db0bc4
commit 87cfe50944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 6 deletions

View File

@ -3042,10 +3042,10 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
Disables 'number', 'relativenumber', 'cursorline',
'cursorcolumn', 'foldcolumn', 'spell' and 'list'
options. 'signcolumn' is changed to `auto` and
'colorcolumn' is cleared. The end-of-buffer region is
hidden by setting `eob` flag of 'fillchars' to a space
char, and clearing the |hl-EndOfBuffer| region in
'winhighlight'.
'colorcolumn' is cleared. 'statuscolumn' is changed to
empty. The end-of-buffer region is hidden by setting
`eob` flag of 'fillchars' to a space char, and clearing
the |hl-EndOfBuffer| region in 'winhighlight'.
• border: Style of (optional) window border. This can either
be a string or an array. The string values are

View File

@ -114,8 +114,9 @@
/// float where the text should not be edited. Disables
/// 'number', 'relativenumber', 'cursorline', 'cursorcolumn',
/// 'foldcolumn', 'spell' and 'list' options. 'signcolumn'
/// is changed to `auto` and 'colorcolumn' is cleared. The
/// end-of-buffer region is hidden by setting `eob` flag of
/// is changed to `auto` and 'colorcolumn' is cleared.
/// 'statuscolumn' is changed to empty. The end-of-buffer
/// region is hidden by setting `eob` flag of
/// 'fillchars' to a space char, and clearing the
/// |hl-EndOfBuffer| region in 'winhighlight'.
/// - border: Style of (optional) window border. This can either be a string

View File

@ -786,6 +786,12 @@ void win_set_minimal_style(win_T *wp)
free_string_option(wp->w_p_cc);
wp->w_p_cc = xstrdup("");
}
// statuscolumn: cleared
if (wp->w_p_stc != NULL && *wp->w_p_stc != NUL) {
free_string_option(wp->w_p_stc);
wp->w_p_stc = xstrdup("");
}
}
void win_config_float(win_T *wp, FloatConfig fconfig)

View File

@ -1329,6 +1329,54 @@ describe('float window', function()
end
end)
it("would not break 'minimal' style with statuscolumn set", function()
command('set number')
command('set signcolumn=yes')
command('set colorcolumn=1')
command('set cursorline')
command('set foldcolumn=1')
command('set statuscolumn=%l%s%C')
command('hi NormalFloat guibg=#333333')
feed('ix<cr>y<cr><esc>gg')
meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'})
if multigrid then
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[3:----------------------------------------]|
## grid 2
{20:1}{21: }{19: }{20: }{22:^x}{21: }|
{14:2 }{19: }{14: }{22:y} |
{14:3 }{19: }{14: }{22: } |
{0:~ }|
{0:~ }|
{0:~ }|
## grid 3
|
## grid 4
{15:x }|
{15:y }|
{15: }|
{15: }|
]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
else
screen:expect{grid=[[
{20:1}{21: }{19: }{20: }{22:^x}{21: }|
{14:2 }{19: }{14: }{22:y} |
{14:3 }{19: }{14: }{22: } {15:x } |
{0:~ }{15:y }{0: }|
{0:~ }{15: }{0: }|
{0:~ }{15: }{0: }|
|
]]}
end
end)
it('can have border', function()
local buf = meths.create_buf(false, false)
meths.buf_set_lines(buf, 0, -1, true, {' halloj! ',