]> granicus.if.org Git - vim/commitdiff
patch 8.2.4026: ml_get error with specific win_execute() command v8.2.4026
authorBram Moolenaar <Bram@vim.org>
Fri, 7 Jan 2022 14:08:03 +0000 (14:08 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 7 Jan 2022 14:08:03 +0000 (14:08 +0000)
Problem:    ml_get error with specific win_execute() command. (Sean Dewar)
Solution:   Check cursor and Visual area are OK.

src/evalwindow.c
src/testdir/test_execute_func.vim
src/version.c

index d29f3e4baa3fafdf0bb50ef8358c5f958e4d3ab7..2a97adcf26773e835b5831ee9272dd142237f0b8 100644 (file)
@@ -743,6 +743,12 @@ f_win_execute(typval_T *argvars, typval_T *rettv)
        // Update the status line if the cursor moved.
        if (win_valid(wp) && !EQUAL_POS(curpos, wp->w_cursor))
            wp->w_redr_status = TRUE;
+
+       // In case the command moved the cursor or changed the Visual area,
+       // check it is valid.
+       check_cursor();
+       if (VIsual_active)
+           check_pos(curbuf, &VIsual);
     }
 }
 
index 0ca31cb6c6f9df10edc9451a5b9549f3cf315689..8cd5e7d270d4a77abc1cca2154bb54250217939b 100644 (file)
@@ -153,8 +153,23 @@ func Test_win_execute_visual_redraw()
   call setline(1, ['a', 'b', 'c'])
   new
   wincmd p
+  " start Visual in current window, redraw in other window with fewer lines
   call feedkeys("G\<C-V>", 'txn')
   call win_execute(winnr('#')->win_getid(), 'redraw')
+  call feedkeys("\<Esc>", 'txn')
+  bwipe!
+  bwipe!
+
+  enew
+  new
+  call setline(1, ['a', 'b', 'c'])
+  let winid = win_getid()
+  wincmd p
+  " start Visual in current window, extend it in other window with more lines
+  call feedkeys("\<C-V>", 'txn')
+  call win_execute(winid, 'call feedkeys("G\<C-V>", ''txn'')')
+  redraw
+
   bwipe!
   bwipe!
 endfunc
index b0bfc29192e8cc85e67bfecc167f433a3070cda5..40c83bfb4a6bf99a309b8d83ee67eaf3528ce1fb 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4026,
 /**/
     4025,
 /**/