patch 9.0.0190: the way 'cmdheight' can be made zero is inconsistent

Problem:    The way 'cmdheight' can be made zero is inconsistent.
Solution:   Only make 'cmdheight' zero when setting it explicitly, not when
            resizing windows. (closes #10890)
diff --git a/src/testdir/dumps/Test_changing_cmdheight_1.dump b/src/testdir/dumps/Test_changing_cmdheight_1.dump
new file mode 100644
index 0000000..db6d411
--- /dev/null
+++ b/src/testdir/dumps/Test_changing_cmdheight_1.dump
@@ -0,0 +1,8 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+| +0&&@74
+@75
+@75
+|:|r|e|s|i|z|e| |-|3| @64
diff --git a/src/testdir/dumps/Test_changing_cmdheight_2.dump b/src/testdir/dumps/Test_changing_cmdheight_2.dump
new file mode 100644
index 0000000..76d9440
--- /dev/null
+++ b/src/testdir/dumps/Test_changing_cmdheight_2.dump
@@ -0,0 +1,8 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+|:+0&&|s|e|t| |c|m|d|h|e|i|g|h|t|+|=|3| @57
+@75
+@75
+@75
diff --git a/src/testdir/dumps/Test_changing_cmdheight_3.dump b/src/testdir/dumps/Test_changing_cmdheight_3.dump
new file mode 100644
index 0000000..d652cc6
--- /dev/null
+++ b/src/testdir/dumps/Test_changing_cmdheight_3.dump
@@ -0,0 +1,8 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+| +0&&@74
+@75
+@75
+@75
+@75
diff --git a/src/testdir/dumps/Test_changing_cmdheight_4.dump b/src/testdir/dumps/Test_changing_cmdheight_4.dump
new file mode 100644
index 0000000..c4d6fc9
--- /dev/null
+++ b/src/testdir/dumps/Test_changing_cmdheight_4.dump
@@ -0,0 +1,8 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+| +0&&@74
+@75
+@75
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 912f3a5..92adbd1 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -215,6 +215,35 @@
   call delete('XTest_redraw')
 endfunc
 
+func Test_changing_cmdheight()
+  CheckScreendump
+
+  let lines =<< trim END
+      set cmdheight=1 laststatus=2
+  END
+  call writefile(lines, 'XTest_cmdheight')
+
+  let buf = RunVimInTerminal('-S XTest_cmdheight', {'rows': 8})
+  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>")
+  call VerifyScreenDump(buf, 'Test_changing_cmdheight_2', {})
+
+  " using more space moves the status line up
+  call term_sendkeys(buf, ":set cmdheight+=1\<CR>")
+  call VerifyScreenDump(buf, 'Test_changing_cmdheight_3', {})
+
+  " reducing cmdheight moves status line down
+  call term_sendkeys(buf, ":set cmdheight-=2\<CR>")
+  call VerifyScreenDump(buf, 'Test_changing_cmdheight_4', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XTest_cmdheight')
+endfunc
+
 func Test_map_completion()
   call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
   call assert_equal('"map <unique> <silent>', getreg(':'))