Commit Diff


commit - 60493ae3298fc9b54e19901e6047ff6620e29c1e
commit + ead14cbec322af4fa0e01bf99fad6e17bfe79f9f
blob - 415e421cb5e54bf46641a98b27a1d016a5dc0150
blob + 9a4a0ef9d7f6fd63caeda2568aa3a9c1c229c48d
--- tog/tog.c
+++ tog/tog.c
@@ -1760,18 +1760,19 @@ search_next_log_view(struct tog_view *view)
 	}
 
 	if (entry) {
+		int cur = s->selected_entry->idx;
 		s->matched_entry = entry;
-		/* XXX This walks the whole list one step at a time... FIXME */
-		s->selected = 0;
-		s->first_displayed_entry = TAILQ_FIRST(&s->commits.head);
-		s->selected_entry = TAILQ_FIRST(&s->commits.head);
-		while (s->selected_entry != s->matched_entry) {
+		while (cur < s->matched_entry->idx) {
 			err = input_log_view(NULL, NULL, NULL, view, KEY_DOWN);
 			if (err)
 				return err;
-			err = show_log_view(view);
+			cur++;
+		}
+		while (cur > s->matched_entry->idx) {
+			err = input_log_view(NULL, NULL, NULL, view, KEY_UP);
 			if (err)
 				return err;
+			cur--;
 		}
 	}