From: Simon Tatham Date: Thu, 7 Dec 2023 17:55:03 +0000 (+0000) Subject: Scroll by a bit less than a full screen in files. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=4b781577d4fa2add85c00d8e6cf60c673c597ebe;p=mastodonochrome.git Scroll by a bit less than a full screen in files. Real Mono does this asymmetrically, it turns out: [SPACE] scrolls down in such a way that the new screenful has 2 lines in common with the old one, whereas [-] scrolls up by a little less so that you have 4 lines in common. I can't quite bring myself to replicate _that_ oddity, so I've compromised on 3 in both directions. --- diff --git a/cursesclient.py b/cursesclient.py index 0583035..1c02cbc 100644 --- a/cursesclient.py +++ b/cursesclient.py @@ -477,8 +477,8 @@ class ObjectFile(File): def move_by(self, delta): return self.move_to(self.linepos + delta) - def down_screen(self): return self.move_by(self.cc.scr_h - 1) - def up_screen(self): return self.move_by(-(self.cc.scr_h - 1)) + def down_screen(self): return self.move_by(max(1, self.cc.scr_h - 3)) + def up_screen(self): return self.move_by(-max(1, self.cc.scr_h - 3)) def down_line(self): return self.move_by(+1) def up_line(self): return self.move_by(-1) def goto_top(self): return self.move_to(0)