Skip to content

Commit e15cbc1

Browse files
luukvbaalchrisbra
authored andcommitted
patch 9.1.0990: Inconsistent behavior when changing cmdheight
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) closes: #16359 Signed-off-by: Luuk van Baal <luukvbaal@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent dbe39ed commit e15cbc1

6 files changed

Lines changed: 115 additions & 131 deletions

File tree

src/testdir/dumps/Test_changing_cmdheight_1.dump

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
| +0&&@74
66
@75
77
@75
8-
|:|r|e|s|i|z|e| |-|3| @64
8+
@75
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
> +0&#ffffff0@74
22
|~+0#4040ff13&| @73
3-
|~| @73
43
|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
5-
|:+0&&|s|e|t| |c|m|d|h|e|i|g|h|t|+|=|3| @57
4+
| +0&&@74
5+
@75
66
@75
77
@75
88
@75

src/testdir/test_autocmd.vim

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4902,4 +4902,28 @@ func Test_autocmd_BufWinLeave_with_vsp()
49024902
exe "bw! " .. dummy
49034903
endfunc
49044904

4905+
func Test_OptionSet_cmdheight()
4906+
set mouse=a laststatus=2
4907+
au OptionSet cmdheight :let &l:ch = v:option_new
4908+
4909+
resize -1
4910+
call assert_equal(2, &l:ch)
4911+
resize +1
4912+
call assert_equal(1, &l:ch)
4913+
4914+
call test_setmouse(&lines - 1, 1)
4915+
call feedkeys("\<LeftMouse>", 'xt')
4916+
call test_setmouse(&lines - 2, 1)
4917+
call feedkeys("\<LeftDrag>", 'xt')
4918+
call assert_equal(2, &l:ch)
4919+
4920+
tabnew | resize +1
4921+
call assert_equal(1, &l:ch)
4922+
tabfirst
4923+
call assert_equal(2, &l:ch)
4924+
4925+
tabonly
4926+
set cmdheight& mouse& laststatus&
4927+
endfunc
4928+
49054929
" vim: shiftwidth=2 sts=2 expandtab

src/testdir/test_cmdline.vim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,10 @@ func Test_changing_cmdheight()
290290
call term_sendkeys(buf, ":resize -3\<CR>")
291291
call VerifyScreenDump(buf, 'Test_changing_cmdheight_1', {})
292292

293-
" using the space available doesn't change the status line
294-
call term_sendkeys(buf, ":set cmdheight+=3\<CR>")
293+
" :resize now also changes 'cmdheight' accordingly
294+
call term_sendkeys(buf, ":set cmdheight+=1\<CR>")
295295
call VerifyScreenDump(buf, 'Test_changing_cmdheight_2', {})
296+
call term_sendkeys(buf, ":set cmdheight-=1\<CR>")
296297

297298
" using more space moves the status line up
298299
call term_sendkeys(buf, ":set cmdheight+=1\<CR>")
@@ -311,7 +312,7 @@ func Test_changing_cmdheight()
311312
call term_sendkeys(buf, ":call EchoTwo()\<CR>")
312313
call VerifyScreenDump(buf, 'Test_changing_cmdheight_6', {})
313314

314-
" increasing 'cmdheight' doesn't clear the messages that need hit-enter
315+
" decreasing 'cmdheight' doesn't clear the messages that need hit-enter
315316
call term_sendkeys(buf, ":call EchoOne()\<CR>")
316317
call VerifyScreenDump(buf, 'Test_changing_cmdheight_7', {})
317318

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
990,
707709
/**/
708710
989,
709711
/**/

0 commit comments

Comments
 (0)