From 707da08aacb29be4b1b7677768b0206301cf50a0 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Wed, 15 Jul 2020 12:07:59 -0400 Subject: implement g and G --- more.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/more.c b/more.c index 253bbc5..3f8d4a3 100644 --- a/more.c +++ b/more.c @@ -1,6 +1,7 @@ #define _XOPEN_SOURCE 700 #include #include +#include #include #include #include @@ -139,21 +140,20 @@ int more(const struct more_tty *mt, const char *file) scroll(mt, &mf, count, -mt->lines / 2); break; - case 'g': - //scroll_beginning(count); - break; - case 'G': - //scroll_end(count); - break; - - case 'r': - case CTRL_L: - refresh(mt, &mf); + if (count == 0) { + count = INT_MAX; + } + /* FALLTHRU */ + case 'g': + scroll(mt, &mf, count - mf.topline, 1); break; case 'R': // discard(); + /* FALLTHRU */ + case 'r': + case CTRL_L: refresh(mt, &mf); break; -- cgit v1.2.1