From 527e45ab5cc919caea9bfee9af1cf3da83028420 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 14 Jul 2020 16:12:49 -0400 Subject: more reliable back-scrolling --- more.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/more.c b/more.c index fc653ab..cefc997 100644 --- a/more.c +++ b/more.c @@ -132,8 +132,12 @@ void scroll(struct morefile *mf, int count, int multiple) size_t n = 0; int by = count ? count * multiple : multiple; - if ((by < 0) && ((-by) > mf->topline)) { - mf->topline = 0; + if (by < 0) { + if ((-by) > mf->topline) { + mf->topline = 0; + } else { + mf->topline += by; + } refresh(mf); } else while (by-- > 0) { mf->topline++; @@ -522,7 +526,7 @@ int main(int argc, char *argv[]) openrawtty(); - global.lines -= 2; + global.lines--; if (optind >= argc) { more("-"); -- cgit v1.2.1