Blame SOURCES/0001-patch-8.2.4154-ml_get-error-when-exchanging-windows-.patch

da4393
diff -up vim82/src/testdir/test_visual.vim.cve0319 vim82/src/testdir/test_visual.vim
da4393
--- vim82/src/testdir/test_visual.vim.cve0319	2022-02-08 13:24:54.170813231 +0100
da4393
+++ vim82/src/testdir/test_visual.vim	2022-02-08 13:26:21.313747976 +0100
da4393
@@ -985,4 +985,15 @@ func Test_visual_block_insert_round_off(
da4393
   bwipe!
da4393
 endfunc
da4393
 
da4393
+" this was causing an ml_get error
da4393
+func Test_visual_exchange_windows()
da4393
+  enew!
da4393
+  new
da4393
+  call setline(1, ['foo', 'bar'])
da4393
+  exe "normal G\<C-V>gg\<C-W>\<C-X>OO\<Esc>"
da4393
+  bwipe!
da4393
+  bwipe!
da4393
+endfunc
da4393
+
da4393
+
da4393
 " vim: shiftwidth=2 sts=2 expandtab
da4393
diff -up vim82/src/window.c.cve0319 vim82/src/window.c
da4393
--- vim82/src/window.c.cve0319	2022-02-08 13:24:54.137813879 +0100
da4393
+++ vim82/src/window.c	2022-02-08 13:24:54.171813211 +0100
da4393
@@ -1697,6 +1697,11 @@ win_exchange(long Prenum)
da4393
 
da4393
     (void)win_comp_pos();		// recompute window positions
da4393
 
da4393
+    if (wp->w_buffer != curbuf)
da4393
+	reset_VIsual_and_resel();
da4393
+    else if (VIsual_active)
da4393
+	wp->w_cursor = curwin->w_cursor;
da4393
+
da4393
     win_enter(wp, TRUE);
da4393
     redraw_all_later(NOT_VALID);
da4393
 }
da4393
@@ -5261,7 +5266,7 @@ frame_remove(frame_T *frp)
da4393
 win_alloc_lines(win_T *wp)
da4393
 {
da4393
     wp->w_lines_valid = 0;
da4393
-    wp->w_lines = ALLOC_CLEAR_MULT(wline_T, Rows );
da4393
+    wp->w_lines = ALLOC_CLEAR_MULT(wline_T, Rows);
da4393
     if (wp->w_lines == NULL)
da4393
 	return FAIL;
da4393
     return OK;