summaryrefslogtreecommitdiffstats
path: root/src/edit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/edit.c b/src/edit.c
index e75a1cf..e1f30c7 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -512,6 +512,7 @@ edit(
#ifdef FEAT_DIFF
&& curwin->w_topfill == old_topfill
#endif
+ && count <= 1
)
{
mincol = curwin->w_wcol;
@@ -549,11 +550,13 @@ edit(
}
// May need to adjust w_topline to show the cursor.
- update_topline();
+ if (count <= 1)
+ update_topline();
did_backspace = FALSE;
- validate_cursor(); // may set must_redraw
+ if (count <= 1)
+ validate_cursor(); // may set must_redraw
/*
* Redraw the display when no characters are waiting.
@@ -566,7 +569,8 @@ edit(
if (curwin->w_p_crb)
do_check_cursorbind();
- update_curswant();
+ if (count <= 1)
+ update_curswant();
old_topline = curwin->w_topline;
#ifdef FEAT_DIFF
old_topfill = curwin->w_topfill;
@@ -2849,7 +2853,6 @@ cursor_down_inner(win_T *wp, long n)
// count each sequence of folded lines as one logical line
while (n--)
{
- // Move to last line of fold, will fail if it's the end-of-file.
if (hasFoldingWin(wp, lnum, NULL, &last, TRUE, NULL))
lnum = last + 1;
else
@@ -2877,8 +2880,11 @@ cursor_down(
{
linenr_T lnum = curwin->w_cursor.lnum;
linenr_T line_count = curwin->w_buffer->b_ml.ml_line_count;
- // This fails if the cursor is already in the last line or would move
- // beyond the last line and '-' is in 'cpoptions'
+ // This fails if the cursor is already in the last (folded) line, or would
+ // move beyond the last line and '-' is in 'cpoptions'.
+#ifdef FEAT_FOLDING
+ hasFoldingWin(curwin, lnum, NULL, &lnum, TRUE, NULL);
+#endif
if (n > 0
&& (lnum >= line_count
|| (lnum + n > line_count