aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjing <lhchenjw@gmail.com>2021-05-01 10:31:15 +0800
committerjing <lhchenjw@gmail.com>2021-05-06 23:45:16 +0800
commitec3524da29b4d3c6cdccb3ab3608f88e8c4ba183 (patch)
tree6192da74baad4ea8c6dd384d17ccafab5a3cab19 /src
parent73154bbae033513a937af8092320920a49684ce6 (diff)
downloadrneovim-ec3524da29b4d3c6cdccb3ab3608f88e8c4ba183.tar.gz
rneovim-ec3524da29b4d3c6cdccb3ab3608f88e8c4ba183.tar.bz2
rneovim-ec3524da29b4d3c6cdccb3ab3608f88e8c4ba183.zip
vim-patch:8.1.2124: ruler is not updated if win_execute() moves cursor
Problem: Ruler is not updated if win_execute() moves cursor. Solution: Update the status line. (closes vim/vim#5022) https://github.com/vim/vim/commit/345f28df5482cd35f5fa74b06443376379f113b0
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval/funcs.c6
-rw-r--r--src/nvim/testdir/test_execute_func.vim20
2 files changed, 26 insertions, 0 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 0b50f41de3..2a046efc0b 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -2047,12 +2047,18 @@ static void f_win_execute(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tabpage_T *save_curtab;
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, fptr, 1);
}
restore_win_noblock(save_curwin, save_curtab, true);
+
+ // Update the status line if the cursor moved.
+ if (win_valid(wp) && !equalpos(curpos, wp->w_cursor)) {
+ wp->w_redr_status = true;
+ }
}
}
diff --git a/src/nvim/testdir/test_execute_func.vim b/src/nvim/testdir/test_execute_func.vim
index 9efed76eda..51df61d762 100644
--- a/src/nvim/testdir/test_execute_func.vim
+++ b/src/nvim/testdir/test_execute_func.vim
@@ -1,5 +1,7 @@
" test execute()
+source view_util.vim
+
func NestedEval()
let nested = execute('echo "nested\nlines"')
echo 'got: "' . nested . '"'
@@ -105,6 +107,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