diff options
Diffstat (limited to 'forwback.c')
-rw-r--r-- | forwback.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/forwback.c b/forwback.c index 83ae78efb28c..dc6cac98afbb 100644 --- a/forwback.c +++ b/forwback.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2016 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -124,7 +124,7 @@ squish_check() */ public void forw(n, pos, force, only_last, nblank) - register int n; + int n; POSITION pos; int force; int only_last; @@ -298,7 +298,7 @@ forw(n, pos, force, only_last, nblank) */ public void back(n, pos, force, only_last) - register int n; + int n; POSITION pos; int force; int only_last; @@ -444,3 +444,21 @@ get_back_scroll() return (sc_height - 2); return (10000); /* infinity */ } + +/* + * Get line count of file up to the screen height + 1 char + */ + public int +get_line_count() +{ + int nlines; + POSITION pos; + + pos = ch_zero(); + for (nlines = 0; nlines <= sc_height; nlines++) + { + pos = forw_line(pos); + if (pos == NULL_POSITION) break; + } + return nlines; +} |