From 4ecea0e001533d68f3032fe0512fc55360f295c0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 25 Aug 2022 19:35:17 +0800 Subject: vim-patch:8.2.0911: crash when opening a buffer for the cmdline window fails Problem: Crash when opening a buffer for the cmdline window fails. (Chris Barber) Solution: Check do_ecmd() succeeds. Reset got_int if "q" was used at the more prompt. (closes vim/vim#6211) https://github.com/vim/vim/commit/9b7cce28d568f0622d77c6c9878c2d4770c3b164 Make code match latest Vim instead. --- test/functional/legacy/cmdline_spec.lua | 79 +++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) (limited to 'test/functional/legacy/cmdline_spec.lua') diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index cf02636890..fb054eed9a 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -1,6 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear = helpers.clear +local command = helpers.command local feed = helpers.feed local feed_command = helpers.feed_command local exec = helpers.exec @@ -141,3 +142,81 @@ describe('cmdline', function() ]]) end) end) + +describe('cmdwin', function() + before_each(clear) + + -- oldtest: Test_cmdwin_interrupted() + it('still uses a new buffer when interrupting more prompt on open', function() + local screen = Screen.new(30, 16) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {bold = true, reverse = true}, -- StatusLine + [2] = {reverse = true}, -- StatusLineNC + [3] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg + [4] = {bold = true}, -- ModeMsg + }) + screen:attach() + command('set more') + command('autocmd WinNew * highlight') + feed('q:') + screen:expect({any = '{3:%-%- More %-%-}^'}) + feed('q') + screen:expect([[ + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {2:[No Name] }| + {0::}^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {1:[Command Line] }| + | + ]]) + feed([[aecho 'done']]) + screen:expect([[ + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {2:[No Name] }| + {0::}echo 'done'^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {1:[Command Line] }| + {4:-- INSERT --} | + ]]) + feed('') + screen:expect([[ + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + done | + ]]) + end) +end) -- cgit From 8fd66ff5c57d29a4349c80d3ae769cde12357ac0 Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 29 Aug 2022 21:58:07 +0200 Subject: fix(redraw): handle switching to a tabpage with larger p_ch value --- test/functional/legacy/cmdline_spec.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'test/functional/legacy/cmdline_spec.lua') diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index fb054eed9a..65b46f793d 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -19,8 +19,6 @@ describe('cmdline', function() [3] = {reverse = true}; [4] = {bold = true, foreground = Screen.colors.Blue1}; } - -- TODO(bfredl): redraw with tabs is severly broken. fix it - feed_command [[ set display-=msgsep ]] feed_command([[call setline(1, range(30))]]) screen:expect([[ @@ -61,7 +59,7 @@ describe('cmdline', function() {4:~ }| | | - :tabnew | + | ]]} feed [[gt]] -- cgit From f4274d0f62625683486d3912dcd6e8e45877c6a4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 31 Aug 2022 09:41:00 +0800 Subject: vim-patch:8.2.3102: test for crash fix does not fail without the fix (#20018) Problem: Test for crash fix does not fail without the fix. Solution: Adjust the test sequence. (closes vim/vim#8506) https://github.com/vim/vim/commit/3777d6e32b22f0a70b774760c24160079e303bad Cherry-pick CheckUnix from patch 8.2.1432. --- test/functional/legacy/cmdline_spec.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/functional/legacy/cmdline_spec.lua') diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 65b46f793d..99d2d0f30e 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -5,6 +5,7 @@ local command = helpers.command local feed = helpers.feed local feed_command = helpers.feed_command local exec = helpers.exec +local pesc = helpers.pesc describe('cmdline', function() before_each(clear) @@ -158,7 +159,7 @@ describe('cmdwin', function() command('set more') command('autocmd WinNew * highlight') feed('q:') - screen:expect({any = '{3:%-%- More %-%-}^'}) + screen:expect({any = pesc('{3:-- More --}^')}) feed('q') screen:expect([[ | -- cgit From 9413f7544bcab6951f9a0c26c4b2e1a6dc477c82 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 20 Sep 2022 20:38:44 +0800 Subject: vim-patch:9.0.0507: cmdline cleared when using :redrawstatus in CmdlineChanged Problem: Command line cleared when using :redrawstatus in CmdlineChanged autocommand event. Solution: Postpone the redraw. (closes vim/vim#11162) https://github.com/vim/vim/commit/bcd6924245c0e73d8be256282656c06aaf91f17c Cherry-pick Test_redraw_in_autocmd() from Vim patch 8.2.4789. --- test/functional/legacy/cmdline_spec.lua | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'test/functional/legacy/cmdline_spec.lua') diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 99d2d0f30e..8ea5754cfa 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -140,6 +140,62 @@ describe('cmdline', function() :^ | ]]) end) + + -- oldtest: Test_redraw_in_autocmd() + it('cmdline cursor position is correct after :redraw with cmdheight=2', function() + local screen = Screen.new(30, 6) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + }) + screen:attach() + exec([[ + set cmdheight=2 + autocmd CmdlineChanged * redraw + ]]) + feed(':for i in range(3)') + screen:expect([[ + | + {0:~ }| + {0:~ }| + {0:~ }| + :for i in range(3) | + : ^ | + ]]) + feed(':let i =') + -- Note: this may still be considered broken, ref #18140 + screen:expect([[ + | + {0:~ }| + {0:~ }| + {0:~ }| + : :let i =^ | + | + ]]) + end) + + -- oldtest: Test_redrawstatus_in_autocmd() + it(':redrawstatus in cmdline mode', function() + local screen = Screen.new(60, 6) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {bold = true, reverse = true}, -- MsgSeparator + }) + screen:attach() + exec([[ + set cmdheight=2 + autocmd CmdlineChanged * if getcmdline() == 'foobar' | redrawstatus | endif + ]]) + feed([[:echo "one\ntwo\nthree\nfour"]]) + feed(':foobar') + screen:expect([[ + {1: }| + one | + two | + three | + four | + :foobar^ | + ]]) + end) end) describe('cmdwin', function() -- cgit From 2e4532bea50e5f6fb68ebf750c461c5704fc58c2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 20 Sep 2022 20:54:07 +0800 Subject: vim-patch:9.0.0512: cannot redraw the status lines when editing a command Problem: Cannot redraw the status lines when editing a command. Solution: Only postpone the redraw when messages have scrolled. (closes vim/vim#11170) https://github.com/vim/vim/commit/c14bfc31d907cbee6a3636f780561ad1787cdb9b --- test/functional/legacy/cmdline_spec.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'test/functional/legacy/cmdline_spec.lua') diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 8ea5754cfa..8325f7eeb0 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -178,13 +178,15 @@ describe('cmdline', function() local screen = Screen.new(60, 6) screen:set_default_attr_ids({ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText - [1] = {bold = true, reverse = true}, -- MsgSeparator + [1] = {bold = true, reverse = true}, -- MsgSeparator, StatusLine }) screen:attach() exec([[ - set cmdheight=2 + set laststatus=2 + set statusline=%=:%{getcmdline()} autocmd CmdlineChanged * if getcmdline() == 'foobar' | redrawstatus | endif ]]) + -- :redrawstatus is postponed if messages have scrolled feed([[:echo "one\ntwo\nthree\nfour"]]) feed(':foobar') screen:expect([[ @@ -195,6 +197,16 @@ describe('cmdline', function() four | :foobar^ | ]]) + -- it is not postponed if messages have not scrolled + feed(':foobar') + screen:expect([[ + | + {0:~ }| + {0:~ }| + {0:~ }| + {1: :foobar}| + :foobar^ | + ]]) end) end) -- cgit From ad1f353fe1aeb54144a34d1a0de8e318bd5113aa Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 21 Sep 2022 06:47:29 +0800 Subject: vim-patch:9.0.0517: when at the command line :redrawstatus does not work well (#20266) Problem: When at the command line :redrawstatus does not work well. Solution: Only update the statuslines instead of the screen. (closes vim/vim#11180) https://github.com/vim/vim/commit/320d910064320f894a09ffdd1cd800ff5371e97f --- test/functional/legacy/cmdline_spec.lua | 53 +++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 6 deletions(-) (limited to 'test/functional/legacy/cmdline_spec.lua') diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 8325f7eeb0..49e3825693 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -175,7 +175,7 @@ describe('cmdline', function() -- oldtest: Test_redrawstatus_in_autocmd() it(':redrawstatus in cmdline mode', function() - local screen = Screen.new(60, 6) + local screen = Screen.new(60, 8) screen:set_default_attr_ids({ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText [1] = {bold = true, reverse = true}, -- MsgSeparator, StatusLine @@ -184,13 +184,16 @@ describe('cmdline', function() exec([[ set laststatus=2 set statusline=%=:%{getcmdline()} - autocmd CmdlineChanged * if getcmdline() == 'foobar' | redrawstatus | endif + autocmd CmdlineChanged * redrawstatus + set display-=msgsep ]]) -- :redrawstatus is postponed if messages have scrolled feed([[:echo "one\ntwo\nthree\nfour"]]) feed(':foobar') screen:expect([[ - {1: }| + {0:~ }| + {0:~ }| + {1: :echo "one\ntwo\nthree\nfour"}| one | two | three | @@ -198,14 +201,52 @@ describe('cmdline', function() :foobar^ | ]]) -- it is not postponed if messages have not scrolled - feed(':foobar') + feed(':for in in range(3)') screen:expect([[ | {0:~ }| {0:~ }| {0:~ }| - {1: :foobar}| - :foobar^ | + {0:~ }| + {0:~ }| + {1: :for in in range(3)}| + :for in in range(3)^ | + ]]) + -- with cmdheight=1 messages have scrolled when typing :endfor + feed(':endfor') + screen:expect([[ + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {1: :for in in range(3)}| + :for in in range(3) | + : :endfor^ | + ]]) + feed(':set cmdheight=2') + -- with cmdheight=2 messages haven't scrolled when typing :for or :endfor + feed(':for in in range(3)') + screen:expect([[ + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {1: :for in in range(3)}| + :for in in range(3)^ | + | + ]]) + feed(':endfor') + screen:expect([[ + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {1: ::endfor}| + :for in in range(3) | + : :endfor^ | ]]) end) end) -- cgit From 6ae144a92171cf9ae52bddddc3a081a4efaabe9f Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 27 Sep 2022 16:19:15 +0200 Subject: feat(messages)!: graduate the 'msgsep' feature The old behaviour (e.g. via `set display-=msgsep`) will not be available. Assuming that messages always are being drawn on msg_grid (or not drawn at all, and forwarded to `ext_messages` enabled UI) will allows some simplifcations and enhancements moving forward. --- test/functional/legacy/cmdline_spec.lua | 77 --------------------------------- 1 file changed, 77 deletions(-) (limited to 'test/functional/legacy/cmdline_spec.lua') diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 49e3825693..88912b9cd4 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -172,83 +172,6 @@ describe('cmdline', function() | ]]) end) - - -- oldtest: Test_redrawstatus_in_autocmd() - it(':redrawstatus in cmdline mode', function() - local screen = Screen.new(60, 8) - screen:set_default_attr_ids({ - [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText - [1] = {bold = true, reverse = true}, -- MsgSeparator, StatusLine - }) - screen:attach() - exec([[ - set laststatus=2 - set statusline=%=:%{getcmdline()} - autocmd CmdlineChanged * redrawstatus - set display-=msgsep - ]]) - -- :redrawstatus is postponed if messages have scrolled - feed([[:echo "one\ntwo\nthree\nfour"]]) - feed(':foobar') - screen:expect([[ - {0:~ }| - {0:~ }| - {1: :echo "one\ntwo\nthree\nfour"}| - one | - two | - three | - four | - :foobar^ | - ]]) - -- it is not postponed if messages have not scrolled - feed(':for in in range(3)') - screen:expect([[ - | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {1: :for in in range(3)}| - :for in in range(3)^ | - ]]) - -- with cmdheight=1 messages have scrolled when typing :endfor - feed(':endfor') - screen:expect([[ - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {1: :for in in range(3)}| - :for in in range(3) | - : :endfor^ | - ]]) - feed(':set cmdheight=2') - -- with cmdheight=2 messages haven't scrolled when typing :for or :endfor - feed(':for in in range(3)') - screen:expect([[ - | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {1: :for in in range(3)}| - :for in in range(3)^ | - | - ]]) - feed(':endfor') - screen:expect([[ - | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {1: ::endfor}| - :for in in range(3) | - : :endfor^ | - ]]) - end) end) describe('cmdwin', function() -- cgit From bc64aa435b84bb3a43501e101c51507c75fbd349 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 6 Oct 2022 09:03:49 +0800 Subject: vim-patch:9.0.0665: setting 'cmdheight' has no effect if last window was resized (#20500) Problem: Setting 'cmdheight' has no effect if last window was resized. Solution: Do apply 'cmdheight' when told to. Use the frame height instead of the cmdline_row. (closes vim/vim#11286) https://github.com/vim/vim/commit/0816f473ab2f6cf7d8311c0f97371cada7f20d18 --- test/functional/legacy/cmdline_spec.lua | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'test/functional/legacy/cmdline_spec.lua') diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 88912b9cd4..e7f5c780dc 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -172,6 +172,47 @@ describe('cmdline', function() | ]]) end) + + it("setting 'cmdheight' works after outputting two messages vim-patch:9.0.0665", function() + local screen = Screen.new(60, 8) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {bold = true, reverse = true}, -- StatusLine + }) + screen:attach() + exec([[ + set cmdheight=1 laststatus=2 + func EchoTwo() + set laststatus=2 + set cmdheight=5 + echo 'foo' + echo 'bar' + set cmdheight=1 + endfunc + ]]) + feed(':call EchoTwo()') + screen:expect([[ + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {1:[No Name] }| + :call EchoTwo()^ | + ]]) + feed('') + screen:expect([[ + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {1:[No Name] }| + | + ]]) + end) end) describe('cmdwin', function() -- cgit From 25dea99ce54de6a8c4369e28e0db82e1af669f24 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 6 Oct 2022 20:03:59 +0800 Subject: vim-patch:9.0.0670: no space for command line when there is a tabline (#20512) Problem: No space for command line when there is a tabline. Solution: Correct computation of where the command line should be. (closes vim/vim#11295) https://github.com/vim/vim/commit/c9f5f73206272ccad0aa536854debc5f9781978a --- test/functional/legacy/cmdline_spec.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/functional/legacy/cmdline_spec.lua') diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index e7f5c780dc..2fceb6a132 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -5,6 +5,7 @@ local command = helpers.command local feed = helpers.feed local feed_command = helpers.feed_command local exec = helpers.exec +local meths = helpers.meths local pesc = helpers.pesc describe('cmdline', function() @@ -213,6 +214,31 @@ describe('cmdline', function() | ]]) end) + + -- oldtest: Test_cmdheight_tabline() + it("changing 'cmdheight' when there is a tabline", function() + local screen = Screen.new(60, 8) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {bold = true, reverse = true}, -- StatusLine + [2] = {bold = true}, -- TabLineSel + [3] = {reverse = true}, -- TabLineFill + }) + screen:attach() + meths.set_option('laststatus', 2) + meths.set_option('showtabline', 2) + meths.set_option('cmdheight', 1) + screen:expect([[ + {2: [No Name] }{3: }| + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {1:[No Name] }| + | + ]]) + end) end) describe('cmdwin', function() -- cgit