summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-01-25 13:52:53 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-25 13:52:53 +0000
commitdc5490e2cbc8c16022a23b449b48c1bd0083f366 (patch)
tree5ce09149d3e81a253401460e4a46c1b98510a0d3
parent85b6747abc15a7a81086db31289cf1b8b17e6cb1 (diff)
downloadvim-git-dc5490e2cbc8c16022a23b449b48c1bd0083f366.tar.gz
patch 8.2.4215: illegal memory access when copying lines in Visual modev8.2.4215
Problem: Illegal memory access when copying lines in Visual mode. Solution: Adjust the Visual position after copying lines.
-rw-r--r--src/ex_cmds.c2
-rw-r--r--src/testdir/test_visual.vim11
-rw-r--r--src/version.c2
3 files changed, 15 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 95209985e..f5d93e664 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -866,6 +866,8 @@ 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/testdir/test_visual.vim b/src/testdir/test_visual.vim
index 72f5388b9..9b322fd21 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -1328,5 +1328,16 @@ func Test_visual_exchange_windows()
bwipe!
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
diff --git a/src/version.c b/src/version.c
index 5d7eccb19..ddc34d864 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4215,
+/**/
4214,
/**/
4213,