" Scroll when cursor becomes invalid in insert mode.
norm Lic
- call assert_equal(curpos[0], getcurpos()[0], 'run ' .. run)
-
- " The line number might be one less because of round-off.
- call assert_inrange(curpos[1] - 1, curpos[1], getcurpos()[1], 'run ' .. run)
-
- call assert_equal(curpos[2], getcurpos()[2], 'run ' .. run)
- call assert_equal(curpos[3], getcurpos()[3], 'run ' .. run)
- call assert_equal(curpos[4], getcurpos()[4], 'run ' .. run)
+ call assert_equal(curpos, getcurpos(), 'run ' .. run)
" No scroll when topline not equal to 1
only | execute "norm gg5\<C-e>" | split | wincmd k
if (*p_spk == 'c') // assume cursor position needs updating
changed_line_abv_curs();
else
- win_fix_cursor(TRUE);
+ // Make sure the cursor position is valid, either by moving the cursor
+ // or by scrolling the text.
+ win_fix_cursor(
+ get_real_state() & (MODE_NORMAL|MODE_CMDLINE|MODE_TERMINAL));
// Now it is OK to parse messages again, which may be needed in
// autocommands.
/*
* Make sure the cursor position is valid for 'splitkeep'.
* If it is not, put the cursor position in the jumplist and move it.
- * If we are not in normal mode, scroll to make valid instead.
+ * If we are not in normal mode ("normal" is zero), make it valid by scrolling
+ * instead.
*/
static void
win_fix_cursor(int normal)