Patch 9.0.1376
Problem:    Accessing invalid memory with put in Visual block mode.
Solution:   Adjust the cursor column if needed.
Files:      src/register.c, src/testdir/test_put.vim


*** ../vim-9.0.1375/src/register.c      2023-02-21 14:27:34.524360386 +0000
--- src/register.c      2023-03-03 21:10:07.289422428 +0000
***************
*** 1928,1934 ****
                ptr += yanklen;
  
                // insert block's trailing spaces only if there's text behind
!               if ((j < count - 1 || !shortline) && spaces)
                {
                    vim_memset(ptr, ' ', (size_t)spaces);
                    ptr += spaces;
--- 1928,1934 ----
                ptr += yanklen;
  
                // insert block's trailing spaces only if there's text behind
!               if ((j < count - 1 || !shortline) && spaces > 0)
                {
                    vim_memset(ptr, ' ', (size_t)spaces);
                    ptr += spaces;
***************
*** 2284,2289 ****
--- 2284,2298 ----
      msgmore(nr_lines);
      curwin->w_set_curswant = TRUE;
  
+     // Make sure the cursor is not after the NUL.
+     int len = (int)STRLEN(ml_get_curline());
+     if (curwin->w_cursor.col > len)
+     {
+       if (cur_ve_flags == VE_ALL)
+           curwin->w_cursor.coladd = curwin->w_cursor.col - len;
+       curwin->w_cursor.col = len;
+     }
+ 
  end:
      if (cmdmod.cmod_flags & CMOD_LOCKMARKS)
      {
*** ../vim-9.0.1375/src/testdir/test_put.vim    2022-06-30 12:30:13.823485781 
+0100
--- src/testdir/test_put.vim    2023-03-03 21:08:53.833435043 +0000
***************
*** 231,235 ****
--- 231,246 ----
    set selection&
  endfunc
  
+ func Test_put_visual_block_mode()
+   enew
+   exe "norm 0R\<CR>\<C-C>V"
+   sil exe "norm \<C-V>c       \<MiddleDrag>"
+   set ve=all
+   sil norm vz=p
+ 
+   bwipe!
+   set ve=
+ endfunc
+ 
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.1375/src/version.c       2023-03-03 15:05:26.784832737 +0000
--- src/version.c       2023-03-03 21:03:40.337575383 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1376,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
219. Your spouse has his or her lawyer deliver the divorce papers...
     via e-mail.

 /// 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/20230303211219.83FDE1C0414%40moolenaar.net.

Raspunde prin e-mail lui