Patch 9.0.0507

6 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 19, 2022, 4:17:17 PM9/19/22
to vim...@googlegroups.com

Patch 9.0.0507
Problem: Command line cleared when using :redrawstatus in CmdlineChanged
autocommand event.
Solution: Postpone the redraw. (closes #11162)
Files: src/ex_docmd.c, src/testdir/test_cmdline.vim,
src/testdir/dumps/Test_redrawstatus_in_autocmd_1.dump


*** ../vim-9.0.0506/src/ex_docmd.c 2022-09-15 21:45:57.485522072 +0100
--- src/ex_docmd.c 2022-09-19 21:11:21.946052934 +0100
***************
*** 8427,8438 ****
int r = RedrawingDisabled;
int p = p_lz;

- RedrawingDisabled = 0;
- p_lz = FALSE;
if (eap->forceit)
status_redraw_all();
else
status_redraw_curbuf();
update_screen(VIsual_active ? UPD_INVERTED : 0);
RedrawingDisabled = r;
p_lz = p;
--- 8427,8441 ----
int r = RedrawingDisabled;
int p = p_lz;

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;
*** ../vim-9.0.0506/src/testdir/test_cmdline.vim 2022-09-15 21:45:57.485522072 +0100
--- src/testdir/test_cmdline.vim 2022-09-19 21:09:42.586226861 +0100
***************
*** 210,215 ****
--- 210,234 ----
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

*** ../vim-9.0.0506/src/testdir/dumps/Test_redrawstatus_in_autocmd_1.dump 2022-09-19 21:12:21.661985669 +0100
--- src/testdir/dumps/Test_redrawstatus_in_autocmd_1.dump 2022-09-19 21:09:45.466221669 +0100
***************
*** 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
*** ../vim-9.0.0506/src/version.c 2022-09-19 18:20:03.795886974 +0100
--- src/version.c 2022-09-19 21:03:54.214843339 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 507,
/**/

--
hundred-and-one symptoms of being an internet addict:
95. Only communication in your household is through email.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages