aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/window.c3
-rw-r--r--test/functional/ui/float_spec.lua7
2 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 002d95ac2a..7c246191a5 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -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.
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 1a9a13f7d4..9ef36cf5ae 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -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