show 'searching...' during 'tog log' search even if no new commits are loaded
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 38 39 40 41 42
diff --git a/tog/tog.c b/tog/tog.c
index 627443f..505f372 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -1517,12 +1517,21 @@ draw_commits(struct tog_view *view, struct commit_queue_entry **last,
goto done;
}
} else {
+ const char *search_str = NULL;
+
+ if (view->searching) {
+ if (view->search_next_done == TOG_SEARCH_NO_MORE)
+ search_str = "no more matches";
+ else if (view->search_next_done == TOG_SEARCH_HAVE_NONE)
+ search_str = "no matches found";
+ else if (!view->search_next_done)
+ search_str = "searching...";
+ }
+
if (asprintf(&ncommits_str, " [%d/%d] %s",
entry ? entry->idx + 1 : 0, commits->ncommits,
- view->search_next_done == TOG_SEARCH_NO_MORE ?
- "no more matches" :
- (view->search_next_done == TOG_SEARCH_HAVE_NONE ?
- "no matches found" : (refs_str ? refs_str : ""))) == -1) {
+ search_str ? search_str :
+ (refs_str ? refs_str : "")) == -1) {
err = got_error_from_errno("asprintf");
goto done;
}
@@ -2060,6 +2069,11 @@ search_next_log_view(struct tog_view *view)
struct tog_log_view_state *s = &view->state.log;
struct commit_queue_entry *entry;
+ /* Display progress update in log view. */
+ show_log_view(view);
+ update_panels();
+ doupdate();
+
if (s->search_entry) {
int errcode, ch;
errcode = pthread_mutex_unlock(&tog_mutex);