aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-12-18 10:15:23 +0800
committerGitHub <noreply@github.com>2023-12-18 10:15:23 +0800
commitd956bc63795ff7a6ff54ad942a7483a5ef76e650 (patch)
treec9f730c0855c09638997acca6ec1428e3d284967
parent6abdc1ac1f904173d01efcf440d1460c001bc299 (diff)
downloadrneovim-d956bc63795ff7a6ff54ad942a7483a5ef76e650.tar.gz
rneovim-d956bc63795ff7a6ff54ad942a7483a5ef76e650.tar.bz2
rneovim-d956bc63795ff7a6ff54ad942a7483a5ef76e650.zip
fix(options): setting 'scroll' with resized grid (#26628)
-rw-r--r--src/nvim/option.c7
-rw-r--r--test/functional/ui/multigrid_spec.lua6
2 files changed, 10 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 6237b11de2..ce4ca92ae8 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -2796,7 +2796,8 @@ static const char *check_num_option_bounds(OptInt *pp, OptInt old_value, char *e
}
}
- if ((curwin->w_p_scr <= 0 || (curwin->w_p_scr > curwin->w_height && curwin->w_height > 0))
+ if ((curwin->w_p_scr <= 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) {
@@ -2806,8 +2807,8 @@ static const char *check_num_option_bounds(OptInt *pp, OptInt old_value, char *e
} 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) {
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index 098c0f7fef..0253b28cd5 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -461,6 +461,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=[[