diff options
author | Christian Clason <c.clason@uni-graz.at> | 2022-01-26 16:37:25 +0100 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2022-01-26 22:00:29 +0100 |
commit | b2b288f33c7a8e780654d5f883dfc2948ff7edc3 (patch) | |
tree | 5b2c5c5b6d92aac0053b09976fb2bc87d8c927aa /src | |
parent | de673966c3b681e8354a26a1f054fbda6e07294a (diff) | |
download | rneovim-b2b288f33c7a8e780654d5f883dfc2948ff7edc3.tar.gz rneovim-b2b288f33c7a8e780654d5f883dfc2948ff7edc3.tar.bz2 rneovim-b2b288f33c7a8e780654d5f883dfc2948ff7edc3.zip |
vim-patch:8.2.4215: illegal memory access when copying lines in Visual mode
Problem: Illegal memory access when copying lines in Visual mode.
Solution: Adjust the Visual position after copying lines.
https://github.com/vim/vim/commit/dc5490e2cbc8c16022a23b449b48c1bd0083f366
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds.c | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_visual.vim | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 95390b1a70..ca5e14ee63 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1099,6 +1099,9 @@ void ex_copy(linenr_T line1, linenr_T line2, linenr_T n) } appended_lines_mark(n, count); + if (VIsual_active) { + check_pos(curbuf, &VIsual); + } msgmore((long)count); } diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index e1e7765e06..5fb4934a1d 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -1151,5 +1151,16 @@ func Test_visual_reselect_with_count() call delete('XvisualReselect') endfunc +" this was leaving the end of the Visual area beyond the end of a line +func Test_visual_ex_copy_line() + new + call setline(1, ["aaa", "bbbbbbbbbxbb"]) + /x + exe "normal ggvjfxO" + t0 + normal gNU + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |