fix(float): fix glitch when making float window with border a split

This commit is contained in:
zeertzjq
2022-05-28 10:53:03 +08:00
parent 99e8298711
commit 63f63dd2b7
2 changed files with 74 additions and 1 deletions

View File

@@ -1266,8 +1266,9 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
} else if (wp->w_floating) {
new_frame(wp);
wp->w_floating = false;
// non-floating window doesn't store float config.
// non-floating window doesn't store float config or have a border.
wp->w_float_config = FLOAT_CONFIG_INIT;
memset(wp->w_border_adj, 0, sizeof(wp->w_border_adj));
}
/*

View File

@@ -6261,6 +6261,78 @@ describe('float window', function()
end
end)
it('J (float with border)', function()
meths.win_set_config(win, {relative='editor', width=20, height=2, row=2, col=5, border='single'})
if multigrid then
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[3:----------------------------------------]|
## grid 2
^x |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
## grid 3
|
## grid 4
{5:┌────────────────────┐}|
{5:│}{1:y }{5:│}|
{5:│}{2:~ }{5:│}|
{5:└────────────────────┘}|
]], float_pos=expected_pos}
else
screen:expect([[
^x |
{0:~ }|
{0:~ }{5:┌────────────────────┐}{0: }|
{0:~ }{5:│}{1:y }{5:│}{0: }|
{0:~ }{5:│}{2:~ }{5:│}{0: }|
{0:~ }{5:└────────────────────┘}{0: }|
|
]])
end
feed("<c-w>w<c-w>J")
if multigrid then
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
[2:----------------------------------------]|
{5:[No Name] [+] }|
[4:----------------------------------------]|
[4:----------------------------------------]|
{4:[No Name] [+] }|
[3:----------------------------------------]|
## grid 2
x |
{0:~ }|
## grid 3
|
## grid 4
^y |
{0:~ }|
]]}
else
screen:expect([[
x |
{0:~ }|
{5:[No Name] [+] }|
^y |
{0:~ }|
{4:[No Name] [+] }|
|
]])
end
end)
it('movements with nested split layout', function()
command("set hidden")
feed("<c-w>s<c-w>v<c-w>b<c-w>v")