diff options
author | luukvbaal <luukvbaal@gmail.com> | 2025-01-05 12:09:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-05 19:09:38 +0800 |
commit | 54ac406649b9e93d756ea62c1a6a587db462039c (patch) | |
tree | 94399fdd02158ed44b7c8f5a25e7d18507a14b3d /test | |
parent | 5e9040648739252b1b8d38c9b46b111767f34cf2 (diff) | |
download | rneovim-54ac406649b9e93d756ea62c1a6a587db462039c.tar.gz rneovim-54ac406649b9e93d756ea62c1a6a587db462039c.tar.bz2 rneovim-54ac406649b9e93d756ea62c1a6a587db462039c.zip |
vim-patch:9.1.0990: Inconsistent behavior when changing cmdheight (#31830)
Problem: Inconsistent behavior when changing cmdheight by resizing the
topframe through wincmds and dragging laststatus. Changing
cmdheight by resizing the topframe does not trigger OptionSet.
Solution: Consolidate logic for changing the cmdheight, set the option
value to handle side-effects (Luuk van Baal)
https://github.com/vim/vim/commit/e15cbc1af47e9dea90448c714eb4908e5d4302fc
vim-patch:9.0.0187: command line height changes when maximizing window height
Problem: Command line height changes when maximizing window height.
Solution: Do not change the command line height. (closes vim/vim#10885)
https://github.com/vim/vim/commit/96bde99bf890acd9952863a02c1d15edca2000e1
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/legacy/cmdline_spec.lua | 46 | ||||
-rw-r--r-- | test/functional/legacy/messages_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/legacy/window_cmd_spec.lua | 2 | ||||
-rw-r--r-- | test/old/testdir/test_autocmd.vim | 24 | ||||
-rw-r--r-- | test/old/testdir/test_cmdline.vim | 7 | ||||
-rw-r--r-- | test/old/testdir/test_window_cmd.vim | 1 |
6 files changed, 76 insertions, 6 deletions
diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 3addcb957c..22700990c1 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -159,6 +159,52 @@ describe('cmdline', function() endfunc ]]) + feed(':resize -3<CR>') + screen:expect([[ + ^ | + {1:~ }|*2 + {3:[No Name] }| + |*4 + ]]) + + -- :resize now also changes 'cmdheight' accordingly + feed(':set cmdheight+=1<CR>') + screen:expect([[ + ^ | + {1:~ }| + {3:[No Name] }| + |*5 + ]]) + feed(':set cmdheight-=1<CR>') + + -- using more space moves the status line up + feed(':set cmdheight+=1<CR>') + screen:expect([[ + ^ | + {1:~ }| + {3:[No Name] }| + |*5 + ]]) + + -- reducing cmdheight moves status line down + feed(':set cmdheight-=2<CR>') + screen:expect([[ + ^ | + {1:~ }|*3 + {3:[No Name] }| + |*3 + ]]) + + -- reducing window size and then setting cmdheight + feed(':resize -1<CR>') + feed(':set cmdheight=1<CR>') + screen:expect([[ + ^ | + {1:~ }|*5 + {3:[No Name] }| + | + ]]) + -- setting 'cmdheight' works after outputting two messages feed(':call EchoTwo()') screen:expect([[ diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index adf75c2836..db5e3f6857 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -82,7 +82,7 @@ describe('messages', function() NoSuchFil^e | three | {1:~ }|*5 - from DebugSilent visual | + | {9:E447: Can't find file "NoSuchFile" in path} | ]]) end) diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua index b58bf0bf43..fac982354c 100644 --- a/test/functional/legacy/window_cmd_spec.lua +++ b/test/functional/legacy/window_cmd_spec.lua @@ -299,7 +299,7 @@ describe('splitkeep', function() c | {1:~ }| {3:[No Name] }| - | + :call win_move_statusline(win, 1) | ]]) end) diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index 40c09e61ac..d5f7c928de 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -4181,4 +4181,28 @@ func Test_autocmd_BufWinLeave_with_vsp() exe "bw! " .. dummy endfunc +func Test_OptionSet_cmdheight() + set mouse=a laststatus=2 + au OptionSet cmdheight :let &l:ch = v:option_new + + resize -1 + call assert_equal(2, &l:ch) + resize +1 + call assert_equal(1, &l:ch) + + call Ntest_setmouse(&lines - 1, 1) + call feedkeys("\<LeftMouse>", 'xt') + call Ntest_setmouse(&lines - 2, 1) + call feedkeys("\<LeftDrag>", 'xt') + call assert_equal(2, &l:ch) + + tabnew | resize +1 + call assert_equal(1, &l:ch) + tabfirst + call assert_equal(2, &l:ch) + + tabonly + set cmdheight& mouse& laststatus& +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index cbce0e908d..3fce086040 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -291,9 +291,10 @@ func Test_changing_cmdheight() call term_sendkeys(buf, ":resize -3\<CR>") call VerifyScreenDump(buf, 'Test_changing_cmdheight_1', {}) - " using the space available doesn't change the status line - call term_sendkeys(buf, ":set cmdheight+=3\<CR>") + " :resize now also changes 'cmdheight' accordingly + call term_sendkeys(buf, ":set cmdheight+=1\<CR>") call VerifyScreenDump(buf, 'Test_changing_cmdheight_2', {}) + call term_sendkeys(buf, ":set cmdheight-=1\<CR>") " using more space moves the status line up call term_sendkeys(buf, ":set cmdheight+=1\<CR>") @@ -312,7 +313,7 @@ func Test_changing_cmdheight() call term_sendkeys(buf, ":call EchoTwo()\<CR>") call VerifyScreenDump(buf, 'Test_changing_cmdheight_6', {}) - " increasing 'cmdheight' doesn't clear the messages that need hit-enter + " decreasing 'cmdheight' doesn't clear the messages that need hit-enter call term_sendkeys(buf, ":call EchoOne()\<CR>") call VerifyScreenDump(buf, 'Test_changing_cmdheight_7', {}) diff --git a/test/old/testdir/test_window_cmd.vim b/test/old/testdir/test_window_cmd.vim index 343bc9fd83..24517f90cb 100644 --- a/test/old/testdir/test_window_cmd.vim +++ b/test/old/testdir/test_window_cmd.vim @@ -56,7 +56,6 @@ func Test_window_cmd_cmdwin_with_vsp() endfunc func Test_cmdheight_not_changed() - throw 'Skipped: N/A' set cmdheight=2 set winminheight=0 augroup Maximize |