]> granicus.if.org Git - vim/commitdiff
patch 8.1.2124: ruler is not updated if win_execute() moves cursor v8.1.2124
authorBram Moolenaar <Bram@vim.org>
Tue, 8 Oct 2019 20:20:35 +0000 (22:20 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 8 Oct 2019 20:20:35 +0000 (22:20 +0200)
Problem:    Ruler is not updated if win_execute() moves cursor.
Solution:   Update the status line. (closes #5022)

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

index 6df14c59278924d46b91a6cf2eaa4038944dab00..76916936dce272142ce8ee1fcb3aabdd0bd04650 100644 (file)
@@ -655,12 +655,18 @@ f_win_execute(typval_T *argvars, typval_T *rettv)
 
     if (wp != NULL && tp != NULL)
     {
+       pos_T   curpos = wp->w_cursor;
+
        if (switch_win_noblock(&save_curwin, &save_curtab, wp, tp, TRUE) == OK)
        {
            check_cursor();
            execute_common(argvars, rettv, 1);
        }
        restore_win_noblock(save_curwin, save_curtab, TRUE);
+
+       // Update the status line if the cursor moved.
+       if (win_valid(wp) && !EQUAL_POS(curpos, wp->w_cursor))
+           wp->w_redr_status = TRUE;
     }
 }
 
index f81a86b6ac8df801580e780e4d3ca57fc043a190..2f02409dea06b8646e25ac4de2e2552157e414f5 100644 (file)
@@ -1,5 +1,7 @@
 " test execute()
 
+source view_util.vim
+
 func NestedEval()
   let nested = execute('echo "nested\nlines"')
   echo 'got: "' . nested . '"'
@@ -101,6 +103,24 @@ func Test_win_execute()
   bwipe!
 endfunc
 
+func Test_win_execute_update_ruler()
+  enew
+  call setline(1, range(500))
+  20
+  split
+  let winid = win_getid()
+  set ruler
+  wincmd w
+  let height = winheight(winid)
+  redraw
+  call assert_match('20,1', Screenline(height + 1))
+  let line = win_execute(winid, 'call cursor(100, 1)')
+  redraw
+  call assert_match('100,1', Screenline(height + 1))
+
+  bwipe!
+endfunc
+
 func Test_win_execute_other_tab()
   let thiswin = win_getid()
   tabnew
index f07d0382cead3bdf38ea4285944df0cc9660960c..514f3c929f54b55059914aea82c903edc168f4f7 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2124,
 /**/
     2123,
 /**/