Commit f9686aa566bfec8d68b52910b3448bdaeb5d2358

Stefan Sperling 2020-03-27T09:35:53

show 'searching...' during 'tog log' search even if no new commits are loaded

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);