Merge pull request #20685 from luukvbaal/scroll

fix: 'scroll' is not set correctly for floats with 'splitkeep'
This commit is contained in:
zeertzjq
2022-10-17 22:04:26 +08:00
committed by GitHub
2 changed files with 8 additions and 2 deletions

View File

@@ -6119,7 +6119,6 @@ void win_fix_scroll(int resize)
invalidate_botline_win(wp);
validate_botline(wp);
}
win_comp_scroll(wp);
wp->w_prev_height = wp->w_height;
wp->w_prev_winrow = wp->w_winrow;
}
@@ -6292,7 +6291,6 @@ void scroll_to_fraction(win_T *wp, int prev_height)
wp->w_prev_fraction_row = wp->w_wrow;
}
win_comp_scroll(wp);
redraw_later(wp, UPD_SOME_VALID);
wp->w_redr_status = true;
invalidate_botline_win(wp);
@@ -6327,6 +6325,7 @@ void win_set_inner_size(win_T *wp, bool valid_cursor)
}
wp->w_skipcol = 0;
wp->w_height_inner = height;
win_comp_scroll(wp);
// There is no point in adjusting the scroll position when exiting. Some
// values might be invalid.

View File

@@ -430,6 +430,13 @@ describe('float window', function()
assert_alive()
end)
it("'scroll' is computed correctly when opening float with splitkeep=screen #20684", function()
meths.set_option('splitkeep', 'screen')
local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10}
local float_win = meths.open_win(0, true, float_opts)
eq(5, meths.win_get_option(float_win, 'scroll'))
end)
describe('with only one tabpage,', function()
local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1}
local old_buf, old_win