Patch 8.2.4789
Problem:    The cursor may be in the in wrong place when using :redraw while
            editing the cmdline.
Solution:   When editing the command line let :redraw update the command line
            too. (closes #10210)
Files:      src/ex_docmd.c, src/testdir/test_cmdline.vim,
            src/testdir/dumps/Test_redraw_in_autocmd_1.dump,
            src/testdir/dumps/Test_redraw_in_autocmd_2.dump


*** ../vim-8.2.4788/src/ex_docmd.c      2022-04-16 18:52:13.225151870 +0100
--- src/ex_docmd.c      2022-04-19 11:36:47.772216989 +0100
***************
*** 8323,8328 ****
--- 8323,8332 ----
      // No need to wait after an intentional redraw.
      need_wait_return = FALSE;
  
+     // When invoked from a callback or autocmd the command line may be active.
+     if (State & CMDLINE)
+       redrawcmdline();
+ 
      out_flush();
  }
  
*** ../vim-8.2.4788/src/testdir/test_cmdline.vim        2022-04-11 
19:38:15.915471119 +0100
--- src/testdir/test_cmdline.vim        2022-04-19 11:35:42.828367202 +0100
***************
*** 193,198 ****
--- 193,220 ----
    call delete('XTest_wildmenu')
  endfunc
  
+ func Test_redraw_in_autocmd()
+   CheckScreendump
+ 
+   let lines =<< trim END
+       set cmdheight=2
+       autocmd CmdlineChanged * redraw
+   END
+   call writefile(lines, 'XTest_redraw')
+ 
+   let buf = RunVimInTerminal('-S XTest_redraw', {'rows': 8})
+   call term_sendkeys(buf, ":for i in range(3)\<CR>")
+   call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_1', {})
+ 
+   call term_sendkeys(buf, "let i =")
+   call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_2', {})
+ 
+   " clean up
+   call term_sendkeys(buf, "\<CR>")
+   call StopVimInTerminal(buf)
+   call delete('XTest_redraw')
+ endfunc
+ 
  func Test_map_completion()
    call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
    call assert_equal('"map <unique> <silent>', getreg(':'))
*** ../vim-8.2.4788/src/testdir/dumps/Test_redraw_in_autocmd_1.dump     
2022-04-19 11:37:43.532101331 +0100
--- src/testdir/dumps/Test_redraw_in_autocmd_1.dump     2022-04-19 
11:32:49.724866769 +0100
***************
*** 0 ****
--- 1,8 ----
+ | +0&#ffffff0@74
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |:+0#0000000&|f|o|r| |i| |i|n| |r|a|n|g|e|(|3|)| @56
+ |:| @1> @71
*** ../vim-8.2.4788/src/testdir/dumps/Test_redraw_in_autocmd_2.dump     
2022-04-19 11:37:43.536101322 +0100
--- src/testdir/dumps/Test_redraw_in_autocmd_2.dump     2022-04-19 
11:32:50.784863200 +0100
***************
*** 0 ****
--- 1,8 ----
+ | +0&#ffffff0@74
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |:+0#0000000&| @1|l|e|t| |i| |=> @64
+ @75
*** ../vim-8.2.4788/src/version.c       2022-04-19 10:25:04.249373674 +0100
--- src/version.c       2022-04-19 11:19:46.756317301 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4789,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
5. Put decaf in the coffee maker for 3 weeks. Once everyone has gotten
   over their caffeine addictions, switch to espresso.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220419103851.3CDED1C0796%40moolenaar.net.

Raspunde prin e-mail lui