diff options
Diffstat (limited to 'contrib/less/jump.c')
-rw-r--r-- | contrib/less/jump.c | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/contrib/less/jump.c b/contrib/less/jump.c index a376486c5e23..2bb4abbc1a09 100644 --- a/contrib/less/jump.c +++ b/contrib/less/jump.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2021 Mark Nudelman + * Copyright (C) 1984-2023 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. @@ -25,8 +25,7 @@ extern int top_scroll; /* * Jump to the end of the file. */ - public void -jump_forw(VOID_PARAM) +public void jump_forw(void) { POSITION pos; POSITION end_pos; @@ -36,6 +35,12 @@ jump_forw(VOID_PARAM) error("Cannot seek to end of file", NULL_PARG); return; } + end_pos = ch_tell(); + if (position(sc_height-1) == end_pos) + { + eof_bell(); + return; + } /* * Note; lastmark will be called later by jump_loc, but it fails * because the position table has been cleared by pos_clear below. @@ -48,7 +53,6 @@ jump_forw(VOID_PARAM) * to get to the beginning of the last line. */ pos_clear(); - end_pos = ch_tell(); pos = back_line(end_pos); if (pos == NULL_POSITION) jump_loc(ch_zero(), sc_height-1); @@ -63,8 +67,7 @@ jump_forw(VOID_PARAM) /* * Jump to the last buffered line in the file. */ - public void -jump_forw_buffered(VOID_PARAM) +public void jump_forw_buffered(void) { POSITION end; @@ -81,9 +84,7 @@ jump_forw_buffered(VOID_PARAM) /* * Jump to line n in the file. */ - public void -jump_back(linenum) - LINENUM linenum; +public void jump_back(LINENUM linenum) { POSITION pos; PARG parg; @@ -114,8 +115,7 @@ jump_back(linenum) /* * Repaint the screen. */ - public void -repaint(VOID_PARAM) +public void repaint(void) { struct scrpos scrpos; /* @@ -134,10 +134,7 @@ repaint(VOID_PARAM) /* * Jump to a specified percentage into the file. */ - public void -jump_percent(percent, fraction) - int percent; - long fraction; +public void jump_percent(int percent, long fraction) { POSITION pos, len; @@ -167,10 +164,7 @@ jump_percent(percent, fraction) * Like jump_loc, but the position need not be * the first character in a line. */ - public void -jump_line_loc(pos, sline) - POSITION pos; - int sline; +public void jump_line_loc(POSITION pos, int sline) { int c; @@ -195,10 +189,7 @@ jump_line_loc(pos, sline) * The position must be the first character in a line. * Place the target line on a specified line on the screen. */ - public void -jump_loc(pos, sline) - POSITION pos; - int sline; +public void jump_loc(POSITION pos, int sline) { int nline; int sindex; |