diff options
author | Shougo <Shougo.Matsu@gmail.com> | 2022-06-13 18:40:51 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-13 02:40:51 -0700 |
commit | 663cbe2620278eae658895f82f3eb9bc89310e73 (patch) | |
tree | 84708a2e6743eda4c351ffd311885039137b7b79 /test/functional/ui/cmdline_spec.lua | |
parent | 2f71d4708e997454a0d05d51122a56146b89af92 (diff) | |
download | rneovim-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/ui/cmdline_spec.lua')
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 155 |
1 files changed, 155 insertions, 0 deletions
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) |