]> granicus.if.org Git - vim/commitdiff
patch 9.0.0011: reading beyond the end of the line with put command v9.0.0011
authorBram Moolenaar <Bram@vim.org>
Thu, 30 Jun 2022 11:30:19 +0000 (12:30 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 30 Jun 2022 11:30:19 +0000 (12:30 +0100)
Problem:    Reading beyond the end of the line with put command.
Solution:   Adjust the end mark position.

src/register.c
src/testdir/test_put.vim
src/version.c

index 93860bae62431651c137053d64d119e197ed90a4..30e2001da46fe8aa961cc183a74ffbb032da5f97 100644 (file)
@@ -1918,6 +1918,8 @@ do_put(
                    vim_memset(ptr, ' ', (size_t)spaces);
                    ptr += spaces;
                }
+               else
+                   totlen -= spaces;  // didn't use these spaces
            }
 
            // may insert some spaces after the new text
index aa5aa2b9906167ac570ce9b7e36fe932f62a44e3..66438bd3f69c6c023aad373f7af02d3f5b0317e6 100644 (file)
@@ -219,5 +219,17 @@ func Test_put_empty_register()
   bwipe!
 endfunc
 
+" this was putting the end mark after the end of the line
+func Test_put_visual_mode()
+  edit! SomeNewBuffer
+  set selection=exclusive
+  exe "norm o\t"
+  m0
+  sil! norm \11\rp\11\rp
+
+  bwipe!
+  set selection&
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab
index c2726aa77ede3bf96863aefdb1a38837a79d1d84..11fd817ed07cf219f7e0742fb28f13af1a24fbdc 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    11,
 /**/
     10,
 /**/