X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fquery.cc;h=e853d4ec8e46b55b260fc0264b1756bf59eb26a1;hp=2169709c7ddcb57980691287670e9cb038c7d151;hb=c168e24174d32563ceb1a35d9bf1875c5bfeac25;hpb=523f1ce0a5e1cbe62dc9b879f224d6b60631322f diff --git a/lib/query.cc b/lib/query.cc index 2169709c..e853d4ec 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -218,9 +218,10 @@ notmuch_query_search_threads (notmuch_query_t *query, thread_id, NULL, (void **) &thread)) { - if (threads_seen > first) { + if (threads_seen >= first) { thread = _notmuch_thread_create (query, query->notmuch, - thread_id); + thread_id, + query->query_string); g_ptr_array_add (threads->threads, thread); } else { thread = NULL; @@ -231,12 +232,12 @@ notmuch_query_search_threads (notmuch_query_t *query, threads_seen++; } - if (thread) - _notmuch_thread_add_message (thread, message); - notmuch_message_destroy (message); messages_seen++; + + if (max_threads >= 0 && threads_seen >= first + max_threads) + break; } /* Stop if we're not seeing any more messages. */