aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorShougo <Shougo.Matsu@gmail.com>2022-06-13 18:40:51 +0900
committerGitHub <noreply@github.com>2022-06-13 02:40:51 -0700
commit663cbe2620278eae658895f82f3eb9bc89310e73 (patch)
tree84708a2e6743eda4c351ffd311885039137b7b79 /test/functional
parent2f71d4708e997454a0d05d51122a56146b89af92 (diff)
downloadrneovim-663cbe2620278eae658895f82f3eb9bc89310e73.tar.gz
rneovim-663cbe2620278eae658895f82f3eb9bc89310e73.tar.bz2
rneovim-663cbe2620278eae658895f82f3eb9bc89310e73.zip
feat: cmdheight=0 #16251
Fix https://github.com/neovim/neovim/issues/1004 Limitation: All outputs need hit-enter prompt. Related: https://github.com/neovim/neovim/pull/6732 https://github.com/neovim/neovim/pull/4382
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/options/num_options_spec.lua2
-rw-r--r--test/functional/ui/cmdline_spec.lua155
-rw-r--r--test/functional/ui/messages_spec.lua1
-rw-r--r--test/functional/ui/statusline_spec.lua4
4 files changed, 160 insertions, 2 deletions
diff --git a/test/functional/options/num_options_spec.lua b/test/functional/options/num_options_spec.lua
index 4754c14f5b..f343e2da75 100644
--- a/test/functional/options/num_options_spec.lua
+++ b/test/functional/options/num_options_spec.lua
@@ -54,7 +54,7 @@ describe(':set validation', function()
should_fail('iminsert', 3, 'E474')
should_fail('imsearch', 3, 'E474')
should_fail('titlelen', -1, 'E487')
- should_fail('cmdheight', 0, 'E487')
+ should_fail('cmdheight', -1, 'E487')
should_fail('updatecount', -1, 'E487')
should_fail('textwidth', -1, 'E487')
should_fail('tabstop', 0, 'E487')
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 3b273fd229..0aee34d367 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -5,6 +5,8 @@ local source = helpers.source
local command = helpers.command
local assert_alive = helpers.assert_alive
local uname = helpers.uname
+local eval = helpers.eval
+local eq = helpers.eq
local function new_screen(opt)
local screen = Screen.new(25, 5)
@@ -858,3 +860,156 @@ describe("cmdline height", function()
assert_alive()
end)
end)
+
+describe('cmdheight=0', function()
+ local screen
+ before_each(function()
+ clear()
+ screen = Screen.new(25, 5)
+ screen:attach()
+ end)
+
+ it("with cmdheight=1 noruler laststatus=2", function()
+ command("set cmdheight=1 noruler laststatus=2")
+ screen:expect{grid=[[
+ ^ |
+ ~ |
+ ~ |
+ [No Name] |
+ |
+ ]]}
+ end)
+
+ it("with cmdheight=0 noruler laststatus=2", function()
+ command("set cmdheight=0 noruler laststatus=2")
+ screen:expect{grid=[[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ [No Name] |
+ ]]}
+ end)
+
+ it("with cmdheight=0 ruler laststatus=0", function()
+ command("set cmdheight=0 ruler laststatus=0")
+ screen:expect{grid=[[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ]]}
+ end)
+
+ it("with cmdheight=0 ruler laststatus=0", function()
+ command("set cmdheight=0 noruler laststatus=0 showmode")
+ feed('i')
+ screen:expect{grid=[[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ]], showmode={}}
+ feed('<Esc>')
+ eq(0, eval('&cmdheight'))
+ end)
+
+ it("with showmode", function()
+ command("set cmdheight=1 noruler laststatus=0 showmode")
+ feed('i')
+ screen:expect{grid=[[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ -- INSERT -- |
+ ]]}
+ feed('<Esc>')
+ eq(1, eval('&cmdheight'))
+ end)
+
+ it("when using command line", function()
+ command("set cmdheight=0 noruler laststatus=0")
+ feed(':')
+ screen:expect{grid=[[
+ |
+ ~ |
+ ~ |
+ ~ |
+ :^ |
+ ]]}
+ eq(1, eval('&cmdheight'))
+ feed('<cr>')
+ screen:expect{grid=[[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ]], showmode={}}
+ eq(0, eval('&cmdheight'))
+ end)
+
+ it("when using input()", function()
+ command("set cmdheight=0 noruler laststatus=0")
+ feed(':call input("foo >")<cr>')
+ screen:expect{grid=[[
+ |
+ ~ |
+ ~ |
+ ~ |
+ foo >^ |
+ ]]}
+ eq(1, eval('&cmdheight'))
+ feed('<cr>')
+ screen:expect{grid=[[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ]], showmode={}}
+ eq(0, eval('&cmdheight'))
+ end)
+
+ it("with winbar and splits", function()
+ command("set cmdheight=0 noruler laststatus=3 winbar=foo")
+ feed(':split<CR>')
+ screen:expect{grid=[[
+ foo |
+ |
+ E36: Not enough room |
+ Press ENTER or type comma|
+ nd to continue^ |
+ ]]}
+ feed('<CR>')
+ screen:expect{grid=[[
+ foo |
+ ^ |
+ ~ |
+ ~ |
+ [No Name] |
+ ]]}
+ feed(':')
+ screen:expect{grid=[[
+ foo |
+ |
+ ~ |
+ [No Name] |
+ :^ |
+ ]]}
+ feed('<Esc>')
+ screen:expect{grid=[[
+ foo |
+ ^ |
+ ~ |
+ ~ |
+ [No Name] |
+ ]], showmode={}}
+ eq(0, eval('&cmdheight'))
+
+ assert_alive()
+ end)
+end)
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 7c789a9e58..e9c0e1b2a1 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -737,7 +737,6 @@ describe('ui/ext_messages', function()
]])
eq(0, eval('&cmdheight'))
- -- normally this would be an error
feed(':set cmdheight=0')
screen:expect{grid=[[
^ |
diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua
index 3e1b284856..2733b9dd4a 100644
--- a/test/functional/ui/statusline_spec.lua
+++ b/test/functional/ui/statusline_spec.lua
@@ -313,5 +313,9 @@ describe('global statusline', function()
eq(2, meths.get_option('cmdheight'))
meths.input_mouse('left', 'drag', '', 0, 14, 10)
eq(1, meths.get_option('cmdheight'))
+ meths.input_mouse('left', 'drag', '', 0, 15, 10)
+ eq(0, meths.get_option('cmdheight'))
+ meths.input_mouse('left', 'drag', '', 0, 14, 10)
+ eq(1, meths.get_option('cmdheight'))
end)
end)