Commit 6524637e4c42250d3584fc9bd12616d4c2e8d823

Stefan Sperling 2019-02-21T21:44:49

fix log and child diff view selection out of sync when scrolling up

diff --git a/tog/tog.c b/tog/tog.c
index dfd3a50..3bdc7f3 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -2174,16 +2174,17 @@ input_diff_view(struct tog_view **new_view, struct tog_view **dead_view,
 		case ',':
 			if (s->log_view == NULL)
 				break;
-			err = input_log_view(NULL, NULL, NULL, s->log_view,
-			    KEY_UP);
-			if (err)
-				break;
 			ls = &s->log_view->state.log;
 			entry = TAILQ_PREV(ls->selected_entry,
 			    commit_queue_head, entry);
 			if (entry == NULL)
 				break;
 
+			err = input_log_view(NULL, NULL, NULL, s->log_view,
+			    KEY_UP);
+			if (err)
+				break;
+
 			err = set_selected_commit(s, entry);
 			if (err)
 				break;
@@ -2197,7 +2198,6 @@ input_diff_view(struct tog_view **new_view, struct tog_view **dead_view,
 		case '.':
 			if (s->log_view == NULL)
 				break;
-
 			ls = &s->log_view->state.log;
 			err = input_log_view(NULL, NULL, NULL, s->log_view,
 			    KEY_DOWN);