diff options
Diffstat (limited to 'alot')
-rw-r--r-- | alot/buffer.py | 6 | ||||
-rw-r--r-- | alot/command.py | 14 | ||||
-rw-r--r-- | alot/db.py | 3 | ||||
-rw-r--r-- | alot/walker.py | 5 |
4 files changed, 18 insertions, 10 deletions
diff --git a/alot/buffer.py b/alot/buffer.py index 03e0cf8a..c25e0b66 100644 --- a/alot/buffer.py +++ b/alot/buffer.py @@ -110,10 +110,10 @@ class SearchBuffer(Buffer): self.isinitialized = True self.result_count = self.dbman.count_messages(self.querystring) - tids = self.dbman.search_thread_ids(self.querystring) - self.threadlist = IteratorWalker(tids.__iter__(), widgets.ThreadlineWidget, + self.tids = self.dbman.search_thread_ids(self.querystring) + self.threadlist = IteratorWalker(self.tids.__iter__(), widgets.ThreadlineWidget, dbman=self.dbman) - self.ui.logger.debug(self.threadlist.lines) + self.ui.logger.debug(len(self.tids)) self.original_widget = urwid.ListBox(self.threadlist) self.ui.logger.debug(self.threadlist.lines) diff --git a/alot/command.py b/alot/command.py index 64d0ba03..a83556d8 100644 --- a/alot/command.py +++ b/alot/command.py @@ -224,12 +224,14 @@ class ToggleThreadTagCommand(Command): threadwidget = sbuffer.get_selected_threadline() #threadwidget.reload_tag(ui.dbman) #threads seem to cache their tags threadwidget.rebuild() #rebuild and redraw the line - #TODO: remove line from searchlist if thread doesn't match the query - #qs="(%s) AND thread:%s"%(sbuffer.querystring,self.thread.get_thread_id()) - #if ui.dbman.count_messages(qs) == 0: - # ui.logger.debug('remove: %s'%self.thread) - # #sbuffer.threadlist.remove(threadwidget) - #sbuffer.rebuild() + #remove line from searchlist if thread doesn't match the query + qs="(%s) AND thread:%s"%(sbuffer.querystring,self.thread.get_thread_id()) + msg_count = ui.dbman.count_messages(qs) + if ui.dbman.count_messages(qs) == 0: + ui.logger.debug('remove: %s'%self.thread) + sbuffer.threadlist.remove(threadwidget) + sbuffer.result_count -= self.thread.get_total_messages() + ui.update_footer() @@ -75,6 +75,9 @@ class Thread: msg.thaw() self.tags = [t for t in self.tags if t not in tags] + def get_thread_id(self): + return self.tid + def get_tags(self): return self.tags diff --git a/alot/walker.py b/alot/walker.py index b3cedffd..b4efb228 100644 --- a/alot/walker.py +++ b/alot/walker.py @@ -28,7 +28,7 @@ class IteratorWalker(urwid.ListWalker): def remove(self, obj): self.lines.remove(obj) self.set_focus(self.focus % len(self.lines)) - + self._modified() def _get_at_pos(self, pos): if pos < 0: # pos too low @@ -56,3 +56,6 @@ class IteratorWalker(urwid.ListWalker): next_widget = None self.empty = True return next_widget + + def get_lines(self): + return self.lines |