summaryrefslogtreecommitdiff
path: root/alot/commands/search.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-06-09 13:03:11 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2012-06-14 20:15:38 +0100
commit46e165f02011f73ee2ce3785e2abf305797a0839 (patch)
treec99f00fb9da817d3bbf2cfb5635e708ff6dbfe3c /alot/commands/search.py
parent7a1ce51c3022337dd4b1f7ee25ff866f5be64ae1 (diff)
fix update result count after tag operations
.. in search buffer. cf issue #463
Diffstat (limited to 'alot/commands/search.py')
-rw-r--r--alot/commands/search.py10
1 files changed, 7 insertions, 3 deletions
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: