changeset 30363:48c73657679c v9.0.0517

patch 9.0.0517: when at the command line :redrawstatus does not work well Commit: https://github.com/vim/vim/commit/320d910064320f894a09ffdd1cd800ff5371e97f Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Sep 20 17:12:13 2022 +0100 patch 9.0.0517: when at the command line :redrawstatus does not work well Problem: When at the command line :redrawstatus does not work well. Solution: Only update the statuslines instead of the screen. (closes https://github.com/vim/vim/issues/11180)
author Bram Moolenaar <Bram@vim.org>
date Tue, 20 Sep 2022 18:15:03 +0200
parents 2922412560ad
children 4400ee690a37
files src/ex_docmd.c src/testdir/dumps/Test_redrawstatus_in_autocmd_1.dump src/testdir/dumps/Test_redrawstatus_in_autocmd_2.dump src/testdir/dumps/Test_redrawstatus_in_autocmd_3.dump src/testdir/dumps/Test_redrawstatus_in_autocmd_4.dump src/testdir/dumps/Test_redrawstatus_in_autocmd_5.dump src/testdir/test_cmdline.vim src/version.c
diffstat 8 files changed, 45 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -8431,12 +8431,15 @@ ex_redrawstatus(exarg_T *eap UNUSED)
 	status_redraw_all();
     else
 	status_redraw_curbuf();
-    if (msg_scrolled)
+    if (msg_scrolled && (State & MODE_CMDLINE))
 	return;  // redraw later
 
     RedrawingDisabled = 0;
     p_lz = FALSE;
-    update_screen(VIsual_active ? UPD_INVERTED : 0);
+    if (State & MODE_CMDLINE)
+	redraw_statuslines();
+    else
+	update_screen(VIsual_active ? UPD_INVERTED : 0);
     RedrawingDisabled = r;
     p_lz = p;
     out_flush();
--- a/src/testdir/dumps/Test_redrawstatus_in_autocmd_1.dump
+++ b/src/testdir/dumps/Test_redrawstatus_in_autocmd_1.dump
@@ -1,6 +1,6 @@
 |~+0#4040ff13#ffffff0| @73
 |~| @73
-| +3#0000000&@73|:
+| +3#0000000&@45|:|e|c|h|o| |"|o|n|e|\|n|t|w|o|\|n|t|h|r|e@1|\|n|f|o|u|r|"
 |o+0&&|n|e| @71
 |t|w|o| @71
 |t|h|r|e@1| @69
--- a/src/testdir/dumps/Test_redrawstatus_in_autocmd_2.dump
+++ b/src/testdir/dumps/Test_redrawstatus_in_autocmd_2.dump
@@ -4,5 +4,5 @@
 |~| @73
 |~| @73
 |~| @73
-| +3#0000000&@67|:|f|o@1|b|a|r
-|:+0&&|f|o@1|b|a|r> @67
+| +3#0000000&@55|:|f|o|r| |i|n| |i|n| |r|a|n|g|e|(|3|)
+|:+0&&|f|o|r| |i|n| |i|n| |r|a|n|g|e|(|3|)> @55
new file mode 100644
--- /dev/null
+++ b/src/testdir/dumps/Test_redrawstatus_in_autocmd_3.dump
@@ -0,0 +1,8 @@
+|~+0#4040ff13#ffffff0| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +3#0000000&@55|:|f|o|r| |i|n| |i|n| |r|a|n|g|e|(|3|)
+|:+0&&|f|o|r| |i|n| |i|n| |r|a|n|g|e|(|3|)| @55
+|:| @1|:|e|n|d|f|o|r> @64
new file mode 100644
--- /dev/null
+++ b/src/testdir/dumps/Test_redrawstatus_in_autocmd_4.dump
@@ -0,0 +1,8 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+| +3#0000000&@55|:|f|o|r| |i|n| |i|n| |r|a|n|g|e|(|3|)
+|:+0&&|f|o|r| |i|n| |i|n| |r|a|n|g|e|(|3|)> @55
+@75
new file mode 100644
--- /dev/null
+++ b/src/testdir/dumps/Test_redrawstatus_in_autocmd_5.dump
@@ -0,0 +1,8 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+| +3#0000000&@66|:@1|e|n|d|f|o|r
+|:+0&&|f|o|r| |i|n| |i|n| |r|a|n|g|e|(|3|)| @55
+|:| @1|:|e|n|d|f|o|r> @64
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -216,7 +216,7 @@ func Test_redrawstatus_in_autocmd()
   let lines =<< trim END
       set laststatus=2
       set statusline=%=:%{getcmdline()}
-      autocmd CmdlineChanged * if getcmdline() == 'foobar' | redrawstatus | endif
+      autocmd CmdlineChanged * redrawstatus
   END
   call writefile(lines, 'XTest_redrawstatus', 'D')
 
@@ -226,8 +226,17 @@ func Test_redrawstatus_in_autocmd()
   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, "\<Esc>:foobar")
+  call term_sendkeys(buf, "\<Esc>:for in in range(3)")
   call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_2', {})
+  " with cmdheight=1 messages have scrolled when typing :endfor
+  call term_sendkeys(buf, "\<CR>:endfor")
+  call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_3', {})
+  call term_sendkeys(buf, "\<CR>:set cmdheight=2\<CR>")
+  " with cmdheight=2 messages haven't scrolled when typing :for or :endfor
+  call term_sendkeys(buf, ":for in in range(3)")
+  call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_4', {})
+  call term_sendkeys(buf, "\<CR>:endfor")
+  call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_5', {})
 
   " clean up
   call term_sendkeys(buf, "\<CR>")
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    517,
+/**/
     516,
 /**/
     515,