commit 9115f665559777d1016af20f094c51e0eeff444c
parent 3b562535c323292637a53d36d9bd341feea2f2c6
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed, 12 Oct 2022 11:35:47 +0800
test: add a test for #20605
Diffstat:
1 file changed, 33 insertions(+), 0 deletions(-)
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
@@ -1027,3 +1027,36 @@ describe('Screen default colors', function()
end}
end)
end)
+
+it('CTRL-F or CTRL-B scrolls a page after UI attach/resize #20605', function()
+ clear()
+ local screen = Screen.new(100, 100)
+ screen:attach()
+ eq(100, meths.get_option('lines'))
+ eq(99, meths.get_option('window'))
+ eq(99, meths.win_get_height(0))
+ feed('1000o<Esc>')
+ eq(903, funcs.line('w0'))
+ feed('<C-B>')
+ eq(806, funcs.line('w0'))
+ feed('<C-B>')
+ eq(709, funcs.line('w0'))
+ feed('<C-F>')
+ eq(806, funcs.line('w0'))
+ feed('<C-F>')
+ eq(903, funcs.line('w0'))
+ feed('G')
+ screen:try_resize(50, 50)
+ eq(50, meths.get_option('lines'))
+ eq(49, meths.get_option('window'))
+ eq(49, meths.win_get_height(0))
+ eq(953, funcs.line('w0'))
+ feed('<C-B>')
+ eq(906, funcs.line('w0'))
+ feed('<C-B>')
+ eq(859, funcs.line('w0'))
+ feed('<C-F>')
+ eq(906, funcs.line('w0'))
+ feed('<C-F>')
+ eq(953, funcs.line('w0'))
+end)