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