diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-04-19 17:50:53 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-04-19 17:56:02 +0200 |
commit | 26f5a8cb8684544ac9d7918e4b679c16e3eadc22 (patch) | |
tree | a8e7f50ccfb50d21fcc5b6204e0d4499292f320e /alot/buffers | |
parent | 994a860af8607aa6fe2a11829fc082ec1b746ca3 (diff) |
buffers/search: revert 66d24cf0f00a58133c159940d8f65a4f622a09eb
This optimization is wrong, since oldest_first is not a reverse of
newest_first.
oldest_first sorts the threads by the oldest message in each thread,
while newest_first sorts by the newest message in each thread.
That results in 'focus last' changing the thread order, which it should
not do.
Diffstat (limited to 'alot/buffers')
-rw-r--r-- | alot/buffers/search.py | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/alot/buffers/search.py b/alot/buffers/search.py index 9ef310d9..b078b109 100644 --- a/alot/buffers/search.py +++ b/alot/buffers/search.py @@ -15,8 +15,6 @@ class SearchBuffer(Buffer): modename = 'search' threads = [] - _REVERSE = {'oldest_first': 'newest_first', - 'newest_first': 'oldest_first'} def __init__(self, ui, initialquery='', sort_order=None): self.dbman = ui.dbman @@ -56,14 +54,10 @@ class SearchBuffer(Buffer): if self.proc.is_alive(): self.proc.terminate() - def rebuild(self, reverse=False): - self.reversed = reverse + def rebuild(self): self.kill_filler_process() - if reverse: - order = self._REVERSE[self.sort_order] - else: - order = self.sort_order + order = self.sort_order exclude_tags = settings.get_notmuch_setting('search', 'exclude_tags') if exclude_tags: @@ -83,8 +77,7 @@ class SearchBuffer(Buffer): return self.threadlist = PipeWalker(self.pipe, ThreadlineWidget, - dbman=self.dbman, - reverse=reverse) + dbman=self.dbman) self.listbox = urwid.ListBox(self.threadlist) self.body = self.listbox @@ -110,18 +103,9 @@ class SearchBuffer(Buffer): self.threadlist._get_next_item() def focus_first(self): - if not self.reversed: - self.body.set_focus(0) - else: - self.rebuild(reverse=False) + self.body.set_focus(0) def focus_last(self): - if self.reversed: - self.body.set_focus(0) - elif self.result_count < 200 or self.sort_order not in self._REVERSE: - self.consume_pipe() - num_lines = len(self.threadlist.get_lines()) - self.body.set_focus(num_lines - 1) - else: - self.rebuild(reverse=True) - + self.consume_pipe() + num_lines = len(self.threadlist.get_lines()) + self.body.set_focus(num_lines - 1) |