]> granicus.if.org Git - vim/commitdiff
patch 8.2.3581: reading character past end of line v8.2.3581
authorBram Moolenaar <Bram@vim.org>
Thu, 4 Nov 2021 15:10:11 +0000 (15:10 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 4 Nov 2021 15:10:11 +0000 (15:10 +0000)
Problem:    Reading character past end of line.
Solution:   Correct the cursor column.

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

index 072effdec41c8a4f83e62e22600108b6f04ca659..052f230dd4146d29377967b1ff9f52b5f2f9e669 100644 (file)
@@ -7774,6 +7774,7 @@ ex_put(exarg_T *eap)
        eap->forceit = TRUE;
     }
     curwin->w_cursor.lnum = eap->line2;
+    check_cursor_col();
     do_put(eap->regname, NULL, eap->forceit ? BACKWARD : FORWARD, 1L,
                                                       PUT_LINE|PUT_CURSLINE);
 }
index 1b67c85a12b694e2b8949a645b9403d1cf06fdcb..b2f212054e1ce0035b5e887f44f9466ddcc9baaa 100644 (file)
@@ -159,5 +159,14 @@ func Test_very_large_count()
   bwipe!
 endfunc
 
+func Test_put_above_first_line()
+  new
+  let @" = 'text'
+  silent! normal 0o00
+  0put
+  call assert_equal('text', getline(1))
+  bwipe!
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab
index 3d34c035c138174539096f8da0b48fab9f28fa4e..7bb4236361bb198f01d6797d8f8ddb68149919f2 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3581,
 /**/
     3580,
 /**/