diff options
author | Lucas Hoffmann <l-m-h@web.de> | 2017-08-02 08:19:01 +0200 |
---|---|---|
committer | Lucas Hoffmann <l-m-h@web.de> | 2017-08-03 20:34:00 +0200 |
commit | 6de3558becb6e64a73504cafd3353c02622b9498 (patch) | |
tree | b1897c566531c9f016723354a70f1e91c1b69186 /alot | |
parent | fd4d4c8fb28fa74b57d1b9de721a4f3e0fd1fafd (diff) |
Fix message count in statusbar after tagging
When the else branch was hit the count was already updated by
SearchBuffer.rebuild() before the hitcount calculation was done and the
final result was obviously off. This fixes it by just counting the
messages in the search result directly.
The same code is implicitly already called in the other branch of the if
statement. So it is hopefully not a big overhead.
Fixes #1098
Diffstat (limited to 'alot')
-rw-r--r-- | alot/commands/search.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/alot/commands/search.py b/alot/commands/search.py index 49d95ebe..57975841 100644 --- a/alot/commands/search.py +++ b/alot/commands/search.py @@ -197,14 +197,6 @@ class TagCommand(Command): logging.debug('all? %s', self.allm) logging.debug('q: %s', testquery) - hitcount_before = ui.dbman.count_messages(testquery) - - def remove_thread(): - logging.debug('remove thread from result list: %s', thread) - if threadline_widget in searchbuffer.threadlist: - # remove this thread from result list - searchbuffer.threadlist.remove(threadline_widget) - def refresh(): # remove thread from resultset if it doesn't match the search query # any more and refresh selected threadline otherwise @@ -212,13 +204,17 @@ class TagCommand(Command): # update total result count if not self.allm: if hitcount_after == 0: - remove_thread() + logging.debug('remove thread from result list: %s', thread) + if threadline_widget in searchbuffer.threadlist: + # remove this thread from result list + searchbuffer.threadlist.remove(threadline_widget) else: threadline_widget.rebuild() + searchbuffer.result_count = searchbuffer.dbman.count_messages( + searchbuffer.querystring) else: searchbuffer.rebuild() - searchbuffer.result_count += (hitcount_after - hitcount_before) ui.update() tags = [x for x in self.tagsstring.split(',') if x] |