mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(float): make "fixed" work with relative=win (#25243)
This commit is contained in:
parent
1db45a9c1f
commit
c5abf487f1
@ -1009,10 +1009,8 @@ void ui_ext_win_position(win_T *wp, bool validate)
|
|||||||
comp_row += grid->comp_row;
|
comp_row += grid->comp_row;
|
||||||
comp_col += grid->comp_col;
|
comp_col += grid->comp_col;
|
||||||
comp_row = MAX(MIN(comp_row, Rows - wp->w_height_outer - (p_ch > 0 ? 1 : 0)), 0);
|
comp_row = MAX(MIN(comp_row, Rows - wp->w_height_outer - (p_ch > 0 ? 1 : 0)), 0);
|
||||||
comp_col = MAX(MIN(comp_col, Columns - wp->w_width_outer), 0);
|
if (!c.fixed || east) {
|
||||||
int right_extra = Columns - (int)c.col - wp->w_width - (c.border_chars[2][0] != 0);
|
comp_col = MAX(MIN(comp_col, Columns - wp->w_width_outer), 0);
|
||||||
if (!(c.anchor & kFloatAnchorEast) && c.fixed && right_extra < 0) {
|
|
||||||
comp_col = (int)c.col;
|
|
||||||
}
|
}
|
||||||
wp->w_winrow = comp_row;
|
wp->w_winrow = comp_row;
|
||||||
wp->w_wincol = comp_col;
|
wp->w_wincol = comp_col;
|
||||||
|
@ -940,85 +940,67 @@ describe('float window', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('window position fixed', function()
|
it('window position fixed', function()
|
||||||
|
command('rightbelow 20vsplit')
|
||||||
local buf = meths.create_buf(false,false)
|
local buf = meths.create_buf(false,false)
|
||||||
command("set nowrap")
|
|
||||||
local win = meths.open_win(buf, false, {
|
local win = meths.open_win(buf, false, {
|
||||||
relative='editor', width=20, height=2, row=2, col=30, anchor = 'NW', fixed = true})
|
relative='win', width=15, height=2, row=2, col=10, anchor='NW', fixed=true})
|
||||||
local expected_pos = {
|
|
||||||
[4]={{id=1001}, 'NW', 1, 2, 30, true},
|
|
||||||
}
|
|
||||||
|
|
||||||
if multigrid then
|
if multigrid then
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
## grid 1
|
## grid 1
|
||||||
[2:----------------------------------------]|
|
[2:-------------------]{5:│}[4:--------------------]|
|
||||||
[2:----------------------------------------]|
|
[2:-------------------]{5:│}[4:--------------------]|
|
||||||
[2:----------------------------------------]|
|
[2:-------------------]{5:│}[4:--------------------]|
|
||||||
[2:----------------------------------------]|
|
[2:-------------------]{5:│}[4:--------------------]|
|
||||||
[2:----------------------------------------]|
|
[2:-------------------]{5:│}[4:--------------------]|
|
||||||
[2:----------------------------------------]|
|
{5:[No Name] }{4:[No Name] }|
|
||||||
[3:----------------------------------------]|
|
[3:----------------------------------------]|
|
||||||
## grid 2
|
## grid 2
|
||||||
^ |
|
|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
|
||||||
## grid 3
|
## grid 3
|
||||||
|
|
|
|
||||||
## grid 4
|
## grid 4
|
||||||
{1: }|
|
^ |
|
||||||
{2:~ }|
|
{0:~ }|
|
||||||
]], float_pos=expected_pos}
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
## grid 5
|
||||||
|
{1: }|
|
||||||
|
{2:~ }|
|
||||||
|
]], float_pos={
|
||||||
|
[5] = {{id = 1002}, "NW", 4, 2, 10, true, 50};
|
||||||
|
}}
|
||||||
else
|
else
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
{5:│}^ |
|
||||||
{0:~ }|
|
{0:~ }{5:│}{0:~ }|
|
||||||
{0:~ }{1: }|
|
{0:~ }{5:│}{0:~ }{1: }|
|
||||||
{0:~ }{2:~ }|
|
{0:~ }{5:│}{0:~ }{2:~ }|
|
||||||
{0:~ }|
|
{0:~ }{5:│}{0:~ }|
|
||||||
{0:~ }|
|
{5:[No Name] }{4:[No Name] }|
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
end
|
end
|
||||||
|
|
||||||
meths.win_set_config(win, {
|
meths.win_set_config(win, {fixed=false})
|
||||||
relative='editor', width=20, height=2, row=2, col=30, anchor = 'NW', fixed = false})
|
|
||||||
|
|
||||||
if multigrid then
|
if multigrid then
|
||||||
screen:expect{grid=[[
|
screen:expect_unchanged()
|
||||||
## grid 1
|
|
||||||
[2:----------------------------------------]|
|
|
||||||
[2:----------------------------------------]|
|
|
||||||
[2:----------------------------------------]|
|
|
||||||
[2:----------------------------------------]|
|
|
||||||
[2:----------------------------------------]|
|
|
||||||
[2:----------------------------------------]|
|
|
||||||
[3:----------------------------------------]|
|
|
||||||
## grid 2
|
|
||||||
^ |
|
|
||||||
{0:~ }|
|
|
||||||
{0:~ }|
|
|
||||||
{0:~ }|
|
|
||||||
{0:~ }|
|
|
||||||
{0:~ }|
|
|
||||||
## grid 3
|
|
||||||
|
|
|
||||||
## grid 4
|
|
||||||
{1: }|
|
|
||||||
{2:~ }|
|
|
||||||
]], float_pos=expected_pos}
|
|
||||||
else
|
else
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
{5:│}^ |
|
||||||
{0:~ }|
|
{0:~ }{5:│}{0:~ }|
|
||||||
{0:~ }{1: }|
|
{0:~ }{5:│}{0:~ }{1: }|
|
||||||
{0:~ }{2:~ }|
|
{0:~ }{5:│}{0:~ }{2:~ }|
|
||||||
{0:~ }|
|
{0:~ }{5:│}{0:~ }|
|
||||||
{0:~ }|
|
{5:[No Name] }{4:[No Name] }|
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user