summaryrefslogtreecommitdiffstats
path: root/src/move.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-02-12 14:29:27 +0000
committerBram Moolenaar <Bram@vim.org>2005-02-12 14:29:27 +0000
commit4399ef4764584a24080670b4869cb8b5d31a4f78 (patch)
treec47e4671d16eeeadc9aa0b9a9cb19576e7c653b9 /src/move.c
parentb11bd7e43f6cdca944dceebaa3c8012d6bf1a74e (diff)
updated for version 7.0050
Diffstat (limited to 'src/move.c')
-rw-r--r--src/move.c30
1 files changed, 28 insertions, 2 deletions
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. */