Skip to content

Commit

Permalink
don't restore focus after rebuild on move jump
Browse files Browse the repository at this point in the history
Limiting the number of results for an exact move last doesn't make sense
if we will try to restore the focus first on the reversed threadlist,
potentially loading all threads with the default configuration.
  • Loading branch information
paretje authored and pazz committed Mar 19, 2021
1 parent e6fb6e8 commit 29e901e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions alot/buffers/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_info(self):
info['result_count_positive'] = 's' if self.result_count > 1 else ''
return info

def rebuild(self, reverse=False):
def rebuild(self, reverse=False, restore_focus=True):
self.isinitialized = True
self.reversed = reverse
selected_thread = None
Expand All @@ -56,7 +56,7 @@ def rebuild(self, reverse=False):
else:
order = self.sort_order

if self.threadlist:
if restore_focus and self.threadlist:
selected_thread = self.get_selected_thread()

exclude_tags = settings.get_notmuch_setting('search', 'exclude_tags')
Expand Down Expand Up @@ -116,7 +116,7 @@ def focus_first(self):
if not self.reversed:
self.body.set_focus(0)
else:
self.rebuild(reverse=False)
self.rebuild(reverse=False, restore_focus=False)
self.body.set_focus(0)

def focus_last(self):
Expand All @@ -129,7 +129,7 @@ def focus_last(self):
num_lines = len(self.threadlist.get_lines())
self.body.set_focus(num_lines - 1)
else:
self.rebuild(reverse=True)
self.rebuild(reverse=True, restore_focus=False)
self.body.set_focus(0)

def focus_thread(self, thread):
Expand Down

0 comments on commit 29e901e

Please sign in to comment.