]> granicus.if.org Git - vim/commitdiff
patch 9.0.0517: when at the command line :redrawstatus does not work well v9.0.0517
authorzeertzjq <zeertzjq@outlook.com>
Tue, 20 Sep 2022 16:12:13 +0000 (17:12 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 20 Sep 2022 16:12:13 +0000 (17:12 +0100)
Problem:    When at the command line :redrawstatus does not work well.
Solution:   Only update the statuslines instead of the screen. (closes #11180)

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 [new file with mode: 0644]
src/testdir/dumps/Test_redrawstatus_in_autocmd_4.dump [new file with mode: 0644]
src/testdir/dumps/Test_redrawstatus_in_autocmd_5.dump [new file with mode: 0644]
src/testdir/test_cmdline.vim
src/version.c

index 8cdf601f863b4f78481f312bb74a10aa669ba531..a786ff0cc6571007d44169676b78da2ced4b7a5f 100644 (file)
@@ -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();
index 50cf6007c072decc4a78528633d2660beb369fb3..d6b3c0d5fcdaa3b24c0828b361dfc330a35ecfec 100644 (file)
@@ -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
index eca2f9a55cff776c26b944c73df0959abbde8b27..0c28c2097938bdef0b0719a1dcd6748a2633688a 100644 (file)
@@ -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
diff --git a/src/testdir/dumps/Test_redrawstatus_in_autocmd_3.dump b/src/testdir/dumps/Test_redrawstatus_in_autocmd_3.dump
new file mode 100644 (file)
index 0000000..9b64605
--- /dev/null
@@ -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
diff --git a/src/testdir/dumps/Test_redrawstatus_in_autocmd_4.dump b/src/testdir/dumps/Test_redrawstatus_in_autocmd_4.dump
new file mode 100644 (file)
index 0000000..8ed408c
--- /dev/null
@@ -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
diff --git a/src/testdir/dumps/Test_redrawstatus_in_autocmd_5.dump b/src/testdir/dumps/Test_redrawstatus_in_autocmd_5.dump
new file mode 100644 (file)
index 0000000..d3e28a8
--- /dev/null
@@ -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
index f81cec930c31deb4b4a15d4d5c7d2ea3ae18f005..00939f9105f8ec0432fd0d094af355756fa3e050 100644 (file)
@@ -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>")
index 61555c1499c3e31951c145ee5b549ab2d0616adf..684f959c8aba1c407f5ce5db148cb506285a38af 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    517,
 /**/
     516,
 /**/