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
test/api: add test for set_cursor always updating the screen
coverity/74362: Initialized Array using ARRAY_DICT_INIT
Merge pull request #1371 from GokuITA/coverity74362

coverity/74362: Initialized Array using ARRAY_DICT_INIT
Merge pull request #951 from bfredl/curfix

api: window_set_cursor doesn't always update position.