diff options
Diffstat (limited to 'more.c')
-rw-r--r-- | more.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -31,7 +31,7 @@ enum { static void more_refresh(struct more_file *mf) { - for (size_t i = mf->topline; i < mf->topline + LINES; i++) { + for (size_t i = mf->topline; i < mf->topline + LINES - 1; i++) { /* FIXME: account for long lines */ if (more_getline(mf, i) == -1) { @@ -189,7 +189,11 @@ static int more(const char *path) int count = 0; while (mf.f) { + int at_eof = 0; //(mf.topline + LINES >= mf.nlines); wmove(more_status, 0, 0); + if (at_eof) { + wprintw(more_status, "%s <EOF>", mf.path); + } int c = wgetch(more_status); wclear(more_status); @@ -205,6 +209,10 @@ static int more(const char *path) case 'f': case CTRL_F: + if (at_eof) { + return 1; + } + if (count == 0) { count = LINES - 1; } @@ -224,6 +232,9 @@ static int more(const char *path) /* FALLTHRU */ case 'j': case '\n': + if (at_eof) { + return 1; + } more_scroll(&mf, count, 1); break; @@ -233,10 +244,16 @@ static int more(const char *path) case 'd': case CTRL_D: + if (at_eof) { + return 1; + } more_scroll(&mf, count, (LINES - 1) / 2); break; case 's': + if (at_eof) { + return 1; + } count = count ? count : 1; more_scroll(&mf, LINES - 1 + count, 1); break; |