From 4399ef4764584a24080670b4869cb8b5d31a4f78 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 12 Feb 2005 14:29:27 +0000 Subject: updated for version 7.0050 --- src/move.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src/move.c') diff --git a/src/move.c b/src/move.c index f3d7825f38..ac59320cfe 100644 --- a/src/move.c +++ b/src/move.c @@ -2332,9 +2332,20 @@ onepage(dir, count) #endif if (dir == FORWARD) { - /* at end of file */ - if (curwin->w_botline > curbuf->b_ml.ml_line_count) + if (firstwin == lastwin && p_window > 0 && p_window < Rows - 1) { + /* Vi compatible scrolling */ + if (p_window <= 2) + ++curwin->w_topline; + else + curwin->w_topline += p_window - 2; + if (curwin->w_topline > curbuf->b_ml.ml_line_count) + curwin->w_topline = curbuf->b_ml.ml_line_count; + curwin->w_cursor.lnum = curwin->w_topline; + } + else if (curwin->w_botline > curbuf->b_ml.ml_line_count) + { + /* at end of file */ curwin->w_topline = curbuf->b_ml.ml_line_count; #ifdef FEAT_DIFF curwin->w_topfill = 0; @@ -2371,6 +2382,21 @@ onepage(dir, count) continue; } #endif + if (firstwin == lastwin && p_window > 0 && p_window < Rows - 1) + { + /* Vi compatible scrolling (sort of) */ + if (p_window <= 2) + --curwin->w_topline; + else + curwin->w_topline -= p_window - 2; + if (curwin->w_topline < 1) + curwin->w_topline = 1; + curwin->w_cursor.lnum = curwin->w_topline + p_window - 1; + if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) + curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; + continue; + } + /* Find the line at the top of the window that is going to be the * line at the bottom of the window. Make sure this results in * the same line as before doing CTRL-F. */ -- cgit v1.2.3