diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2014-07-14 13:54:15 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2014-11-01 12:04:47 +0100 |
commit | b34705bf5fd807203b9cb07d91755bd09d808d18 (patch) | |
tree | 661c492d0db4a4ab7ad0722bcc3f8f29d94e3968 /src/nvim/api/window.c | |
parent | 591391b9bc9a28fc1052d6fb22e297bca32555f7 (diff) | |
download | rneovim-b34705bf5fd807203b9cb07d91755bd09d808d18.tar.gz rneovim-b34705bf5fd807203b9cb07d91755bd09d808d18.tar.bz2 rneovim-b34705bf5fd807203b9cb07d91755bd09d808d18.zip |
api/window_set_cursor: make sure cursor line is visible.
Previously, the cursor could be left outside the visible range if window
is not the current window
Diffstat (limited to 'src/nvim/api/window.c')
-rw-r--r-- | src/nvim/api/window.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index fde1ebfa4c..597c857ad5 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -9,6 +9,7 @@ #include "nvim/cursor.h" #include "nvim/window.h" #include "nvim/screen.h" +#include "nvim/move.h" #include "nvim/misc2.h" @@ -86,6 +87,10 @@ void window_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) win->w_cursor.coladd = 0; // When column is out of range silently correct it. check_cursor_col_win(win); + + // make sure cursor is in visible range even if win != curwin + update_topline_win(win); + update_screen(VALID); } |