From 6f04d3f3ef5eb45c224dabc64373783de9d3f721 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 29 Jan 2022 06:05:39 +0800 Subject: vim-patch:8.2.3581: reading character past end of line Problem: Reading character past end of line. Solution: Correct the cursor column. https://github.com/vim/vim/commit/0b5b06cb4777d1401fdf83e7d48d287662236e7e --- src/nvim/ex_docmd.c | 1 + src/nvim/testdir/test_put.vim | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index c30d58a8eb..43c0d1d0a2 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -8133,6 +8133,7 @@ static void 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, 1, PUT_LINE|PUT_CURSLINE); } diff --git a/src/nvim/testdir/test_put.vim b/src/nvim/testdir/test_put.vim index 4b708fc6a1..ed76709a56 100644 --- a/src/nvim/testdir/test_put.vim +++ b/src/nvim/testdir/test_put.vim @@ -138,6 +138,15 @@ func Test_p_with_count_leaves_mark_at_end() bwipe! endfunc +func Test_put_above_first_line() + new + let @" = 'text' + silent! normal 0o00 + 0put + call assert_equal('text', getline(1)) + bwipe! +endfunc + func Test_multibyte_op_end_mark() new call setline(1, 'ั‚ะตัั‚') -- cgit