fix(options): setting 'scroll' with resized grid

This commit is contained in:
zeertzjq
2023-12-18 10:15:23 +08:00
parent 20bd03f166
commit ea748157e1
2 changed files with 9 additions and 4 deletions

View File

@@ -2626,8 +2626,7 @@ static const char *set_num_option(int opt_idx, char *varp, long value, char *err
}
if ((curwin->w_p_scr <= 0
|| (curwin->w_p_scr > curwin->w_height
&& curwin->w_height > 0))
|| (curwin->w_p_scr > curwin->w_height_inner && curwin->w_height_inner > 0))
&& full_screen) {
if (pp == &(curwin->w_p_scr)) {
if (curwin->w_p_scr != 0) {
@@ -2637,8 +2636,8 @@ static const char *set_num_option(int opt_idx, char *varp, long value, char *err
} else if (curwin->w_p_scr <= 0) {
// If 'scroll' became invalid because of a side effect silently adjust it.
curwin->w_p_scr = 1;
} else { // curwin->w_p_scr > curwin->w_height
curwin->w_p_scr = curwin->w_height;
} else { // curwin->w_p_scr > curwin->w_height_inner
curwin->w_p_scr = curwin->w_height_inner;
}
}
if ((p_sj < -100 || p_sj >= Rows) && full_screen) {

View File

@@ -886,6 +886,12 @@ describe('ext_multigrid', function()
eq(20, win_info.height)
end)
it("'scroll' option works properly", function()
eq(10, meths.get_option_value('scroll', { win = 0 }))
meths.set_option_value('scroll', 15, { win = 0 })
eq(15, meths.get_option_value('scroll', { win = 0 }))
end)
it('gets written till grid width', function()
insert(('a'):rep(60).."\n")
screen:expect{grid=[[