Commit bcf2df4dedd660c46912750d9032412a2b7b7822

Stefan Sperling 2019-06-21T22:35:35

tog log search: assign matched entries in a more obvious way

diff --git a/tog/tog.c b/tog/tog.c
index 1e70527..ec46106 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -1771,6 +1771,7 @@ search_next_log_view(struct tog_view *view)
 
 		if (match_commit(entry->commit, &s->regex)) {
 			view->search_next_done = 1;
+			s->matched_entry = entry;
 			break;
 		}
 		if (view->searching == TOG_SEARCH_FORWARD)
@@ -1779,9 +1780,8 @@ search_next_log_view(struct tog_view *view)
 			entry = TAILQ_PREV(entry, commit_queue_head, entry);
 	}
 
-	if (entry) {
+	if (s->matched_entry) {
 		int cur = s->selected_entry->idx;
-		s->matched_entry = entry;
 		while (cur < s->matched_entry->idx) {
 			err = input_log_view(NULL, NULL, NULL, view, KEY_DOWN);
 			if (err)