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

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