Commit d2dfcfbf4e1b7906855fce76f1d631c35c5c8a05

Stefan Sperling 2018-07-12T23:22:11

don't page-down scroll beyond EOF in tog blame view

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/tog/tog.c b/tog/tog.c
index 66fdd7e..f025bcd 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -1667,7 +1667,8 @@ show_blame_view(const char *path, struct got_object_id *commit_id,
 			case ' ':
 				if (last_displayed_line >= blame.nlines &&
 				    selected_line < LINES - 2) {
-					selected_line = LINES - 2;
+					selected_line = MIN(blame.nlines,
+					    LINES - 2);
 					break;
 				}
 				if (last_displayed_line + LINES - 2 <=