|
|
13ea7f |
From dc5490e2cbc8c16022a23b449b48c1bd0083f366 Mon Sep 17 00:00:00 2001
|
|
|
13ea7f |
From: Bram Moolenaar <Bram@vim.org>
|
|
|
13ea7f |
Date: Tue, 25 Jan 2022 13:52:53 +0000
|
|
|
13ea7f |
Subject: [PATCH] patch 8.2.4215: illegal memory access when copying lines in
|
|
|
13ea7f |
Visual mode
|
|
|
13ea7f |
|
|
|
13ea7f |
Problem: Illegal memory access when copying lines in Visual mode.
|
|
|
13ea7f |
Solution: Adjust the Visual position after copying lines.
|
|
|
13ea7f |
---
|
|
|
13ea7f |
src/ex_cmds.c | 2 ++
|
|
|
13ea7f |
src/testdir/test_visual.vim | 11 +++++++++++
|
|
|
13ea7f |
src/version.c | 2 ++
|
|
|
13ea7f |
3 files changed, 15 insertions(+)
|
|
|
13ea7f |
|
|
|
13ea7f |
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
|
|
|
13ea7f |
index 95209985e..f5d93e664 100644
|
|
|
13ea7f |
--- a/src/ex_cmds.c
|
|
|
13ea7f |
+++ b/src/ex_cmds.c
|
|
|
13ea7f |
@@ -866,6 +866,8 @@ ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
|
|
|
13ea7f |
}
|
|
|
13ea7f |
|
|
|
13ea7f |
appended_lines_mark(n, count);
|
|
|
13ea7f |
+ if (VIsual_active)
|
|
|
13ea7f |
+ check_pos(curbuf, &VIsual);
|
|
|
13ea7f |
|
|
|
13ea7f |
msgmore((long)count);
|
|
|
13ea7f |
}
|
|
|
13ea7f |
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
|
|
|
13ea7f |
index 72f5388b9..9b322fd21 100644
|
|
|
13ea7f |
--- a/src/testdir/test_visual.vim
|
|
|
13ea7f |
+++ b/src/testdir/test_visual.vim
|
|
|
13ea7f |
@@ -1328,5 +1328,16 @@ func Test_visual_exchange_windows()
|
|
|
13ea7f |
bwipe!
|
|
|
13ea7f |
endfunc
|
|
|
13ea7f |
|
|
|
13ea7f |
+" this was leaving the end of the Visual area beyond the end of a line
|
|
|
13ea7f |
+func Test_visual_ex_copy_line()
|
|
|
13ea7f |
+ new
|
|
|
13ea7f |
+ call setline(1, ["aaa", "bbbbbbbbbxbb"])
|
|
|
13ea7f |
+ /x
|
|
|
13ea7f |
+ exe "normal ggvjfxO"
|
|
|
13ea7f |
+ t0
|
|
|
13ea7f |
+ normal gNU
|
|
|
13ea7f |
+ bwipe!
|
|
|
13ea7f |
+endfunc
|
|
|
13ea7f |
+
|
|
|
13ea7f |
|
|
|
13ea7f |
" vim: shiftwidth=2 sts=2 expandtab
|
|
|
13ea7f |
--
|
|
|
13ea7f |
2.34.1
|
|
|
13ea7f |
|