diff --git a/alot/buffers/search.py b/alot/buffers/search.py index c3487fd24..04031a42b 100644 --- a/alot/buffers/search.py +++ b/alot/buffers/search.py @@ -61,20 +61,28 @@ def rebuild(self, reverse=False): if exclude_tags: exclude_tags = [t for t in exclude_tags.split(';') if t] - try: - self.result_count = self.dbman.count_messages(self.querystring) - threads = self.dbman.get_threads( - self.querystring, order, exclude_tags) - except NotmuchError: - self.ui.notify('malformed query string: %s' % self.querystring, - 'error') - self.listbox = urwid.ListBox([]) - self.body = self.listbox - return - - self.threadlist = IterableWalker(threads, ThreadlineWidget, - dbman=self.dbman, - reverse=reverse) + self.result_count = 0 + self.threadlist = None + querylist = self.querystring.split(' / ') + for query in querylist: + try: + self.result_count += self.dbman.count_messages(query) + threads = self.dbman.get_threads( + query, order, exclude_tags) + except NotmuchError: + self.ui.notify('malformed query string: %s' % query, + 'error') + self.listbox = urwid.ListBox([]) + self.body = self.listbox + return + + iterablewalker = IterableWalker(threads, ThreadlineWidget, + dbman=self.dbman, + reverse=reverse) + if self.threadlist: + self.threadlist.append(iterablewalker) + else: + self.threadlist = iterablewalker self.listbox = urwid.ListBox(self.threadlist) self.body = self.listbox diff --git a/alot/walker.py b/alot/walker.py index cfefc9e61..bdb42797d 100644 --- a/alot/walker.py +++ b/alot/walker.py @@ -2,6 +2,7 @@ # Copyright © 2018 Dylan Baker # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file +import itertools import logging import urwid @@ -92,3 +93,6 @@ def _get_next_item(self): def get_lines(self): return self.lines + + def append(self, iterableWalker): + self.iterable = itertools.chain(self.iterable, iterableWalker.iterable)