chiark / gitweb /
Scroll by a bit less than a full screen in files.
authorSimon Tatham <anakin@pobox.com>
Thu, 7 Dec 2023 17:55:03 +0000 (17:55 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 7 Dec 2023 17:55:03 +0000 (17:55 +0000)
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.

cursesclient.py

index 0583035367b56b774346462c81a7d820fc5d68da..1c02cbc8461a1a1a483283b8a280779061c7e7b6 100644 (file)
@@ -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)