aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-12 12:20:14 +0800
committerGitHub <noreply@github.com>2022-10-12 12:20:14 +0800
commitf175ca9f7cc29054b1c6fe1fd1076edd78af5684 (patch)
tree63c4762733932d9ab5ea298362c4fe07aa81d2e4
parent45cc5fd7656c48606bf337a4cc01380bedc8ba36 (diff)
parent9115f665559777d1016af20f094c51e0eeff444c (diff)
downloadrneovim-f175ca9f7cc29054b1c6fe1fd1076edd78af5684.tar.gz
rneovim-f175ca9f7cc29054b1c6fe1fd1076edd78af5684.tar.bz2
rneovim-f175ca9f7cc29054b1c6fe1fd1076edd78af5684.zip
Merge pull request #20606 from zeertzjq/vim-8.2.4523
vim-patch:8.2.4523: when gvim is started maximized the 'window' option isn't set
-rw-r--r--src/nvim/window.c2
-rw-r--r--test/functional/ui/screen_basic_spec.lua33
2 files changed, 34 insertions, 1 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index d7ca718c68..d99d22af12 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5226,7 +5226,7 @@ void win_new_screensize(void)
if (old_Rows != Rows) {
// If 'window' uses the whole screen, keep it using that.
// Don't change it when set with "-w size" on the command line.
- if (p_window == old_Rows - 1 || (old_Rows == 0 && p_window == 0)) {
+ if (p_window == old_Rows - 1 || (old_Rows == 0 && !option_was_set("window"))) {
p_window = Rows - 1;
}
old_Rows = Rows;
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 58c8238c35..f111aa2513 100644
--- 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)