Patch 8.2.5013
Problem:    After text formatting the cursor may be in an invalid position.
Solution:   Correct the cursor position after formatting.
Files:      src/textformat.c, src/testdir/test_textformat.vim


*** ../vim-8.2.5012/src/textformat.c    2022-05-23 13:10:39.726713326 +0100
--- src/textformat.c    2022-05-24 13:55:19.870175760 +0100
***************
*** 870,875 ****
--- 870,878 ----
      {
        curwin->w_cursor = saved_cursor;
        saved_cursor.lnum = 0;
+ 
+       // formatting may have made the cursor position invalid
+       check_cursor();
      }
  
      if (oap->is_VIsual)
*** ../vim-8.2.5012/src/testdir/test_textformat.vim     2022-05-23 
13:10:39.726713326 +0100
--- src/testdir/test_textformat.vim     2022-05-24 13:54:33.094192582 +0100
***************
*** 1291,1294 ****
--- 1291,1306 ----
    close!
  endfunc
  
+ " This was leaving the cursor after the end of a line.  Complicated way to
+ " have the problem show up with valgrind.
+ func Test_correct_cursor_position()
+   set encoding=iso8859
+   new
+   norm a000“         0
+   sil! norm gggg0i0   gw0gg
+ 
+   bwipe!
+   set encoding=utf8
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.5012/src/version.c       2022-05-24 11:49:27.910175908 +0100
--- src/version.c       2022-05-24 13:51:21.606253571 +0100
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     5013,
  /**/

-- 
FIRST HEAD: All right! All right! We'll kill him first and then have tea and
            biscuits.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20220524125827.758231C1FBD%40moolenaar.net.

Raspunde prin e-mail lui