changeset 10881:8f6df2f6d2fc v8.0.0330

patch 8.0.0330: illegal memory access after "vapo" commit https://github.com/vim/vim/commit/84b2a381451e9068b09ef6d85f5e8cf1598e7355 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 17 11:40:00 2017 +0100 patch 8.0.0330: illegal memory access after "vapo" Problem: Illegal memory access after "vapo". (Dominique Pelle) Solution: Fix the cursor column.
author Christian Brabandt <cb@256bit.org>
date Fri, 17 Feb 2017 11:45:04 +0100
parents 7d9d6a327e18
children 2ef6f4092d68
files src/search.c src/testdir/test_visual.vim src/version.c
diffstat 3 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c
+++ b/src/search.c
@@ -4241,7 +4241,11 @@ extend:
 	 * line, we get stuck there.  Trap this here. */
 	if (VIsual_mode == 'V' && start_lnum == curwin->w_cursor.lnum)
 	    goto extend;
-	VIsual.lnum = start_lnum;
+	if (VIsual.lnum != start_lnum)
+	{
+	    VIsual.lnum = start_lnum;
+	    VIsual.col = 0;
+	}
 	VIsual_mode = 'V';
 	redraw_curbuf_later(INVERTED);	/* update the inversion */
 	showmode();
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -36,3 +36,10 @@ func Test_Visual_ctrl_o()
   set tw&
   bw!
 endfu
+
+func Test_Visual_vapo()
+  new
+  normal oxx
+  normal vapo
+  bwipe!
+endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    330,
+/**/
     329,
 /**/
     328,