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. --- src/nvim/testdir/test_cmdline.vim | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 7443ff8fa4..faf68d038e 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -127,6 +127,46 @@ func Test_wildmenu_screendump() call delete('XTest_wildmenu') endfunc +func Test_redraw_in_autocmd() + CheckScreendump + + let lines =<< trim END + set cmdheight=2 + autocmd CmdlineChanged * redraw + END + call writefile(lines, 'XTest_redraw', 'D') + + let buf = RunVimInTerminal('-S XTest_redraw', {'rows': 8}) + call term_sendkeys(buf, ":for i in range(3)\") + call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_1', {}) + + call term_sendkeys(buf, "let i =") + call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_2', {}) + + " clean up + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) +endfunc + +func Test_redrawstatus_in_autocmd() + CheckScreendump + + let lines =<< trim END + set cmdheight=2 + autocmd CmdlineChanged * if getcmdline() == 'foobar' | redrawstatus | endif + END + call writefile(lines, 'XTest_redrawstatus', 'D') + + let buf = RunVimInTerminal('-S XTest_redrawstatus', {'rows': 8}) + call term_sendkeys(buf, ":echo \"one\\ntwo\\nthree\\nfour\"\") + call term_sendkeys(buf, ":foobar") + call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_1', {}) + + " clean up + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) +endfunc + func Test_changing_cmdheight() CheckScreendump -- 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 --- src/nvim/testdir/test_cmdline.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index faf68d038e..9fc92b8f25 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -152,15 +152,20 @@ func Test_redrawstatus_in_autocmd() CheckScreendump let lines =<< trim END - set cmdheight=2 + set laststatus=2 + set statusline=%=:%{getcmdline()} autocmd CmdlineChanged * if getcmdline() == 'foobar' | redrawstatus | endif END call writefile(lines, 'XTest_redrawstatus', 'D') let buf = RunVimInTerminal('-S XTest_redrawstatus', {'rows': 8}) + " :redrawstatus is postponed if messages have scrolled call term_sendkeys(buf, ":echo \"one\\ntwo\\nthree\\nfour\"\") call term_sendkeys(buf, ":foobar") call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_1', {}) + " it is not postponed if messages have not scrolled + call term_sendkeys(buf, "\:foobar") + call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_2', {}) " clean up call term_sendkeys(buf, "\") -- cgit