Mercurial > vim
changeset 30343:4c9b74365164 v9.0.0507
patch 9.0.0507: cmdline cleared when using :redrawstatus in CmdlineChanged
Commit: https://github.com/vim/vim/commit/bcd6924245c0e73d8be256282656c06aaf91f17c
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 19 21:16:12 2022 +0100
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 #11162)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 19 Sep 2022 22:30:07 +0200 |
parents | 930fed9ccf0d |
children | 141ac9cb1d6f |
files | src/ex_docmd.c src/testdir/dumps/Test_redrawstatus_in_autocmd_1.dump src/testdir/test_cmdline.vim src/version.c |
diffstat | 4 files changed, 34 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -8427,12 +8427,15 @@ ex_redrawstatus(exarg_T *eap UNUSED) int r = RedrawingDisabled; int p = p_lz; - RedrawingDisabled = 0; - p_lz = FALSE; if (eap->forceit) status_redraw_all(); else status_redraw_curbuf(); + if (State & MODE_CMDLINE) + return; // redraw later + + RedrawingDisabled = 0; + p_lz = FALSE; update_screen(VIsual_active ? UPD_INVERTED : 0); RedrawingDisabled = r; p_lz = p;
new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_redrawstatus_in_autocmd_1.dump @@ -0,0 +1,8 @@ +|~+0#4040ff13#ffffff0| @73 +|~| @73 +|~| @73 +|o+0#0000000&|n|e| @71 +|t|w|o| @71 +|t|h|r|e@1| @69 +|f|o|u|r| @70 +|:|f|o@1|b|a|r> @67
--- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -210,6 +210,25 @@ func Test_redraw_in_autocmd() 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\"\<CR>") + call term_sendkeys(buf, ":foobar") + call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_1', {}) + + " clean up + call term_sendkeys(buf, "\<CR>") + call StopVimInTerminal(buf) +endfunc + func Test_changing_cmdheight() CheckScreendump