Commit 67cc79918593c9bc8a93290de429035ae0464f18

Stefan Sperling 2019-01-24T23:07:05

improve tog tree view page-up scrolling behaviour

diff --git a/tog/tog.c b/tog/tog.c
index ddf367c..8d1f3a2 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -3283,16 +3283,13 @@ input_tree_view(struct tog_view **new_view, struct tog_view **dead_view,
 			    s->entries, s->tree == s->root);
 			break;
 		case KEY_PPAGE:
-			s->selected = 0;
-			if (SIMPLEQ_FIRST(&s->entries->head) ==
-			    s->first_displayed_entry) {
-				if (s->tree != s->root)
-					s->first_displayed_entry = NULL;
-				break;
-			}
 			tree_scroll_up(&s->first_displayed_entry,
-			    view->nlines, s->entries,
+			    MAX(0, view->nlines - 4 - s->selected), s->entries,
 			    s->tree == s->root);
+			s->selected = 0;
+			if (SIMPLEQ_FIRST(&s->entries->head) ==
+			    s->first_displayed_entry && s->tree != s->root)
+				s->first_displayed_entry = NULL;
 			break;
 		case 'j':
 		case KEY_DOWN: