Skip to content

Commit 5c93039

Browse files
committed
Fix going ahead of the history of the file turning screen blank forever.
When pressing back (`[`) until before the commit that added the inspected file, the blame contents go blank (makes sense). When going forward again, until now it was possible that they stay blank because `highlight_line` could become `-1`, and once this happened, it would stay `-1` forever. This commit fixes it by making sure that `max_highlight` cannot be negative.
1 parent bb83656 commit 5c93039

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gitbrowse/ui.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def highlight_line(self):
8181

8282
@highlight_line.setter
8383
def highlight_line(self, value):
84-
# Ensure highlighted line in sane
85-
max_highlight = len(self.file_history.blame()) - 1
84+
# Ensure highlighted line is sane
85+
max_highlight = max(0, len(self.file_history.blame()) - 1)
8686
if value < 0:
8787
value = 0
8888
elif value > max_highlight:

0 commit comments

Comments
 (0)