Mercurial > vim
diff src/move.c @ 164:8b0ee9d57d7f
updated for version 7.0050
author | vimboss |
---|---|
date | Sat, 12 Feb 2005 14:29:27 +0000 |
parents | 6df0106fc595 |
children | 7052f11a3dc9 |
line wrap: on
line diff
--- 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. */