clear search when not refreshing sort

This commit is contained in:
woorst
2017-07-18 15:27:35 -05:00
parent d06c9647ed
commit 1807ea4aad
2 changed files with 5 additions and 5 deletions

View File

@@ -118,7 +118,7 @@ class Page(object):
self.term.show_notification('Invalid option') self.term.show_notification('Invalid option')
return return
self.refresh_content(order=choices[ch]) self.refresh_content(order=choices[ch], with_search=True)
@PageController.register(Command('SORT_RISING')) @PageController.register(Command('SORT_RISING'))
def sort_content_rising(self): def sort_content_rising(self):
@@ -126,7 +126,7 @@ class Page(object):
@PageController.register(Command('SORT_NEW')) @PageController.register(Command('SORT_NEW'))
def sort_content_new(self): def sort_content_new(self):
self.refresh_content(order='new') self.refresh_content(order='new', with_search=True)
@PageController.register(Command('SORT_CONTROVERSIAL')) @PageController.register(Command('SORT_CONTROVERSIAL'))
def sort_content_controversial(self): def sort_content_controversial(self):
@@ -147,7 +147,7 @@ class Page(object):
self.term.show_notification('Invalid option') self.term.show_notification('Invalid option')
return return
self.refresh_content(order=choices[ch]) self.refresh_content(order=choices[ch], with_search=True)
@PageController.register(Command('MOVE_UP')) @PageController.register(Command('MOVE_UP'))
def move_cursor_up(self): def move_cursor_up(self):

View File

@@ -36,12 +36,12 @@ class SubredditPage(Page):
self.toggled_subreddit = None self.toggled_subreddit = None
@SubredditController.register(Command('REFRESH')) @SubredditController.register(Command('REFRESH'))
def refresh_content(self, order=None, name=None): def refresh_content(self, order=None, name=None, with_search=False):
"Re-download all submissions and reset the page index" "Re-download all submissions and reset the page index"
order = order or self.content.order order = order or self.content.order
name = name or self.content.name name = name or self.content.name
query = self.content.query query = self.content.query if with_search else None
# Hack to allow an order specified in the name by prompt_subreddit() to # Hack to allow an order specified in the name by prompt_subreddit() to
# override the current default # override the current default