don't let search in 'tog log' wrap around to beginning/end of history
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/tog/tog.c b/tog/tog.c
index 77aba92..77bc11a 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -1764,23 +1764,16 @@ search_next_log_view(struct tog_view *view)
while (1) {
if (entry == NULL) {
- if (s->thread_args.log_complete) {
- if (s->matched_entry == NULL) {
- view->search_next_done = 1;
- return NULL;
- }
- if (view->searching == TOG_SEARCH_FORWARD)
- entry = TAILQ_FIRST(&s->commits.head);
- else
- entry = TAILQ_LAST(&s->commits.head,
- commit_queue_head);
- } else {
- s->thread_args.commits_needed = 1;
- return trigger_log_thread(0,
- &s->thread_args.commits_needed,
- &s->thread_args.log_complete,
- &s->thread_args.need_commits);
+ if (s->thread_args.log_complete ||
+ view->searching == TOG_SEARCH_BACKWARD) {
+ view->search_next_done = 1;
+ return NULL;
}
+ s->thread_args.commits_needed = 1;
+ return trigger_log_thread(0,
+ &s->thread_args.commits_needed,
+ &s->thread_args.log_complete,
+ &s->thread_args.need_commits);
}
if (match_commit(entry->commit, &view->regex)) {