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
This commit is contained in:
Björn Linse
2014-07-14 13:54:15 +02:00
parent 591391b9bc
commit b34705bf5f
2 changed files with 17 additions and 0 deletions

View File

@@ -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);
}