From 1807ea4aad1fe07af85ce6ea0e5dca84a6866058 Mon Sep 17 00:00:00 2001 From: woorst Date: Tue, 18 Jul 2017 15:27:35 -0500 Subject: [PATCH] clear search when not refreshing sort --- rtv/page.py | 6 +++--- rtv/subreddit_page.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rtv/page.py b/rtv/page.py index 1ee6611..8b7b768 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -118,7 +118,7 @@ class Page(object): self.term.show_notification('Invalid option') return - self.refresh_content(order=choices[ch]) + self.refresh_content(order=choices[ch], with_search=True) @PageController.register(Command('SORT_RISING')) def sort_content_rising(self): @@ -126,7 +126,7 @@ class Page(object): @PageController.register(Command('SORT_NEW')) def sort_content_new(self): - self.refresh_content(order='new') + self.refresh_content(order='new', with_search=True) @PageController.register(Command('SORT_CONTROVERSIAL')) def sort_content_controversial(self): @@ -147,7 +147,7 @@ class Page(object): self.term.show_notification('Invalid option') return - self.refresh_content(order=choices[ch]) + self.refresh_content(order=choices[ch], with_search=True) @PageController.register(Command('MOVE_UP')) def move_cursor_up(self): diff --git a/rtv/subreddit_page.py b/rtv/subreddit_page.py index ca59abe..6c960b5 100644 --- a/rtv/subreddit_page.py +++ b/rtv/subreddit_page.py @@ -36,12 +36,12 @@ class SubredditPage(Page): self.toggled_subreddit = None @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" order = order or self.content.order 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 # override the current default