From 46e165f02011f73ee2ce3785e2abf305797a0839 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Sat, 9 Jun 2012 13:03:11 +0100 Subject: fix update result count after tag operations .. in search buffer. cf issue #463 --- alot/commands/search.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'alot/commands/search.py') diff --git a/alot/commands/search.py b/alot/commands/search.py index 366a7f63..3ea1e461 100644 --- a/alot/commands/search.py +++ b/alot/commands/search.py @@ -157,21 +157,25 @@ class TagCommand(Command): thread = threadline_widget.get_thread() testquery = "(%s) AND thread:%s" % (searchbuffer.querystring, thread.get_thread_id()) + 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) - searchbuffer.result_count -= thread.get_total_messages() def refresh(): # remove thread from resultset if it doesn't match the search query # any more and refresh selected threadline otherwise - if ui.dbman.count_messages(testquery) == 0: + hitcount_after = ui.dbman.count_messages(testquery) + if hitcount_after == 0: remove_thread() - ui.update() else: threadline_widget.rebuild() + # update total result count + searchbuffer.result_count += (hitcount_after - hitcount_before) + ui.update() tags = filter(lambda x: x, self.tagsstring.split(',')) try: -- cgit v1.2.3