Patch 8.2.4154
Problem:    ml_get error when exchanging windows in Visual mode.
Solution:   Correct end of Visual area when entering another buffer.
Files:      src/window.c, src/testdir/test_visual.vim


*** ../vim-8.2.4153/src/window.c        2022-01-08 18:43:36.877446896 +0000
--- src/window.c        2022-01-20 13:29:36.744453905 +0000
***************
*** 1691,1696 ****
--- 1691,1701 ----
  
      (void)win_comp_pos();             // recompute window positions
  
+     if (wp->w_buffer != curbuf)
+       reset_VIsual_and_resel();
+     else if (VIsual_active)
+       wp->w_cursor = curwin->w_cursor;
+ 
      win_enter(wp, TRUE);
      redraw_all_later(NOT_VALID);
  }
***************
*** 5332,5338 ****
  win_alloc_lines(win_T *wp)
  {
      wp->w_lines_valid = 0;
!     wp->w_lines = ALLOC_CLEAR_MULT(wline_T, Rows );
      if (wp->w_lines == NULL)
        return FAIL;
      return OK;
--- 5337,5343 ----
  win_alloc_lines(win_T *wp)
  {
      wp->w_lines_valid = 0;
!     wp->w_lines = ALLOC_CLEAR_MULT(wline_T, Rows);
      if (wp->w_lines == NULL)
        return FAIL;
      return OK;
*** ../vim-8.2.4153/src/testdir/test_visual.vim 2022-01-20 12:10:45.052814746 
+0000
--- src/testdir/test_visual.vim 2022-01-20 13:21:14.540171383 +0000
***************
*** 1318,1322 ****
--- 1318,1332 ----
    bwipe!
  endfunc
  
+ " this was causing an ml_get error
+ func Test_visual_exchange_windows()
+   enew!
+   new
+   call setline(1, ['foo', 'bar'])
+   exe "normal G\<C-V>gg\<C-W>\<C-X>OO\<Esc>"
+   bwipe!
+   bwipe!
+ endfunc
+ 
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4153/src/version.c       2022-01-20 12:44:23.523631726 +0000
--- src/version.c       2022-01-20 13:23:02.690222624 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4154,
  /**/

-- 
Q: What's orange and sounds like a parrot?
A: A carrot

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220120133457.A1A431C188D%40moolenaar.net.

Raspunde prin e-mail lui