]> granicus.if.org Git - vim/commitdiff
patch 9.0.0512: cannot redraw the status lines when editing a command v9.0.0512
authorzeertzjq <zeertzjq@outlook.com>
Tue, 20 Sep 2022 12:17:57 +0000 (13:17 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 20 Sep 2022 12:17:57 +0000 (13:17 +0100)
Problem:    Cannot redraw the status lines when editing a command.
Solution:   Only postpone the redraw when messages have scrolled.
            (closes #11170)

src/ex_docmd.c
src/testdir/dumps/Test_redrawstatus_in_autocmd_1.dump
src/testdir/dumps/Test_redrawstatus_in_autocmd_2.dump [new file with mode: 0644]
src/testdir/test_cmdline.vim
src/version.c

index 3076d5344b422acb5d78c33def0a3ea2a1db5114..8cdf601f863b4f78481f312bb74a10aa669ba531 100644 (file)
@@ -8431,7 +8431,7 @@ ex_redrawstatus(exarg_T *eap UNUSED)
        status_redraw_all();
     else
        status_redraw_curbuf();
-    if (State & MODE_CMDLINE)
+    if (msg_scrolled)
        return;  // redraw later
 
     RedrawingDisabled = 0;
index 91e436444cf08b7c7e6a5b09b8ce03659d695f8e..50cf6007c072decc4a78528633d2660beb369fb3 100644 (file)
@@ -1,7 +1,7 @@
 |~+0#4040ff13#ffffff0| @73
 |~| @73
-|~| @73
-|o+0#0000000&|n|e| @71
+| +3#0000000&@73|:
+|o+0&&|n|e| @71
 |t|w|o| @71
 |t|h|r|e@1| @69
 |f|o|u|r| @70
diff --git a/src/testdir/dumps/Test_redrawstatus_in_autocmd_2.dump b/src/testdir/dumps/Test_redrawstatus_in_autocmd_2.dump
new file mode 100644 (file)
index 0000000..eca2f9a
--- /dev/null
@@ -0,0 +1,8 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +3#0000000&@67|:|f|o@1|b|a|r
+|:+0&&|f|o@1|b|a|r> @67
index 3014ac36a5c67411b1945c4615932d97086d5530..f81cec930c31deb4b4a15d4d5c7d2ea3ae18f005 100644 (file)
@@ -214,15 +214,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\"\<CR>")
   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 VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_2', {})
 
   " clean up
   call term_sendkeys(buf, "\<CR>")
index c6f76acb834ab3d40c6f2faa2f492dbe80a4d760..55da620bc03734e50805d49450f1d4c388facf7c 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    512,
 /**/
     511,
 /**/