Patch 8.2.3625
Problem:    Illegal memory access when C-indenting.
Solution:   Also set the cursor column.
Files:      src/cindent.c, src/testdir/test_cindent.vim


*** ../vim-8.2.3624/src/cindent.c       2021-10-05 21:58:49.164899480 +0100
--- src/cindent.c       2021-11-19 19:39:52.299790745 +0000
***************
*** 1637,1646 ****
      static pos_T *
  find_start_brace(void)            // XXX
  {
!     pos_T     cursor_save;
!     pos_T     *trypos;
!     pos_T     *pos;
!     static pos_T      pos_copy;
  
      cursor_save = curwin->w_cursor;
      while ((trypos = findmatchlimit(NULL, '{', FM_BLOCKSTOP, 0)) != NULL)
--- 1637,1646 ----
      static pos_T *
  find_start_brace(void)            // XXX
  {
!     pos_T         cursor_save;
!     pos_T         *trypos;
!     pos_T         *pos;
!     static pos_T    pos_copy;
  
      cursor_save = curwin->w_cursor;
      while ((trypos = findmatchlimit(NULL, '{', FM_BLOCKSTOP, 0)) != NULL)
***************
*** 1654,1660 ****
                       && (pos = ind_find_start_CORS(NULL)) == NULL) // XXX
            break;
        if (pos != NULL)
!           curwin->w_cursor.lnum = pos->lnum;
      }
      curwin->w_cursor = cursor_save;
      return trypos;
--- 1654,1660 ----
                       && (pos = ind_find_start_CORS(NULL)) == NULL) // XXX
            break;
        if (pos != NULL)
!           curwin->w_cursor = *pos;
      }
      curwin->w_cursor = cursor_save;
      return trypos;
*** ../vim-8.2.3624/src/testdir/test_cindent.vim        2021-10-05 
21:58:49.164899480 +0100
--- src/testdir/test_cindent.vim        2021-11-19 19:38:30.655517674 +0000
***************
*** 5314,5317 ****
--- 5314,5329 ----
    bwipe!
  endfunc
  
+ func Test_find_brace_backwards()
+   " this was looking beyond the end of the line
+   new
+   norm R/*
+   norm o0{
+   norm o//
+   norm V{=
+   call assert_equal(['/*', '   0{', '//'], getline(1, 3))
+   bwipe!
+ endfunc
+ 
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3624/src/version.c       2021-11-19 17:01:05.559037762 +0000
--- src/version.c       2021-11-19 19:30:47.156462528 +0000
***************
*** 759,760 ****
--- 759,762 ----
  {   /* Add new patch number below this line */
+ /**/
+     3625,
  /**/

-- 
TALL KNIGHT:   Firstly.  You must get us another shrubbery!
OTHER KNIGHTS: More shrubberies!  More shrubberies for the ex-Knights of Ni!
ARTHUR:        Not another shrubbery -
                 "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/20211119194151.C1EB01C3E54%40moolenaar.net.

Raspunde prin e-mail lui