Blame SOURCES/0001-patch-8.2.4215-illegal-memory-access-when-copying-li.patch

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