From 0b5b06cb4777d1401fdf83e7d48d287662236e7e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 4 Nov 2021 15:10:11 +0000 Subject: patch 8.2.3581: reading character past end of line Problem: Reading character past end of line. Solution: Correct the cursor column. --- src/ex_docmd.c | 1 + src/testdir/test_put.vim | 9 +++++++++ src/version.c | 2 ++ 3 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 072effdec..052f230dd 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -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); } diff --git a/src/testdir/test_put.vim b/src/testdir/test_put.vim index 1b67c85a1..b2f212054 100644 --- a/src/testdir/test_put.vim +++ b/src/testdir/test_put.vim @@ -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 diff --git a/src/version.c b/src/version.c index 3d34c035c..7bb423636 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3581, /**/ 3580, /**/ -- cgit v1.2.1