patch 9.0.0114: the command line takes up space even when not used
Problem: The command line takes up space even when not used.
Solution: Allow for 'cmdheight' to be set to zero. (Shougo Matsushita,
closes #10675, closes #940)
diff --git a/src/testdir/gen_opt_test.vim b/src/testdir/gen_opt_test.vim
index 83f43f7..a552160 100644
--- a/src/testdir/gen_opt_test.vim
+++ b/src/testdir/gen_opt_test.vim
@@ -27,7 +27,7 @@
" Two lists with values: values that work and values that fail.
" When not listed, "othernum" or "otherstring" is used.
let test_values = {
- \ 'cmdheight': [[1, 2, 10], [-1, 0]],
+ \ 'cmdheight': [[0, 1, 2, 10], [-1]],
\ 'cmdwinheight': [[1, 2, 10], [-1, 0]],
\ 'columns': [[12, 80], [-1, 0, 10]],
\ 'conceallevel': [[0, 1, 2, 3], [-1, 4, 99]],
diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim
index acdbe18..ea5aee1 100644
--- a/src/testdir/test_messages.vim
+++ b/src/testdir/test_messages.vim
@@ -387,4 +387,51 @@
call delete('b.txt')
endfunc
+func Test_cmdheight_zero()
+ set cmdheight=0
+ set showcmd
+ redraw!
+
+ echo 'test echo'
+ call assert_equal(116, screenchar(&lines, 1))
+ redraw!
+
+ echomsg 'test echomsg'
+ call assert_equal(116, screenchar(&lines, 1))
+ redraw!
+
+ call feedkeys(":ls\<CR>", "xt")
+ call assert_equal(':ls', Screenline(&lines - 1))
+ redraw!
+
+ let char = getchar(0)
+ call assert_match(char, 0)
+
+ " Check change/restore cmdheight when macro
+ call feedkeys("qa", "xt")
+ call assert_equal(&cmdheight, 1)
+ call feedkeys("q", "xt")
+ call assert_equal(&cmdheight, 0)
+
+ call setline(1, 'somestring')
+ call feedkeys("y", "n")
+ %s/somestring/otherstring/gc
+ call assert_equal(getline(1), 'otherstring')
+
+ call feedkeys("g\<C-g>", "xt")
+ call assert_match(
+ \ 'Col 1 of 11; Line 1 of 1; Word 1 of 1',
+ \ Screenline(&lines))
+
+ " Check split behavior
+ for i in range(1, 10)
+ split
+ endfor
+ only
+ call assert_equal(&cmdheight, 0)
+
+ set cmdheight&
+ set showcmd&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
index 47988b2..cfa5b63 100644
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -1481,9 +1481,12 @@
call assert_equal(h0, winheight(0))
call assert_equal(1, &cmdheight)
endfor
+ " supports cmdheight=0
+ set cmdheight=0
call assert_true(win_move_statusline(0, 1))
- call assert_equal(h0, winheight(0))
- call assert_equal(1, &cmdheight)
+ call assert_equal(h0 + 1, winheight(0))
+ call assert_equal(0, &cmdheight)
+ set cmdheight&
" check win_move_statusline from bottom window on top window ID
let id = win_getid(1)
for offset in range(5)