Mercurial > hg > crecord
changeset 24:7a5f2826d4ba
crecord: show context lines at beginning and end of screen
author | Mark Edgington <edgimar@gmail.com> |
---|---|
date | Tue, 16 Dec 2008 01:22:51 +0100 |
parents | bc902e61c93d |
children | 31f8a2c238ee |
files | crecord.py |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/crecord.py +++ b/crecord.py @@ -834,14 +834,20 @@ "Scroll the screen in such a way to fully show the currently-selected item." selStart = self.selectedItemStartLine selEnd = self.selectedItemEndLine + #selNumLines = selEnd - selStart padStart = self.firstLineOfPadToPrint padEnd = padStart + self.yScreenSize - self.numStatusLines - 1 + screenMiddleLine = self.yScreenSize / 2 + # 'buffered' pad start/end values which scroll with a certain + # top/bottom context margin + padStartBuffered = padStart + 3 + padEndBuffered = padEnd - 3 - if selEnd > padEnd: - self.scrollLines(selEnd - padEnd) - elif selStart < padStart: + if selEnd > padEndBuffered: + self.scrollLines(selEnd - padEndBuffered) + elif selStart < padStartBuffered: # negative values scroll in pgup direction - self.scrollLines(selStart - padStart) + self.scrollLines(selStart - padStartBuffered) def scrollLines(self, numLines):