From 85e8d8c82f1c88753804c39ca5f6bee2e0c4ae2c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 15 May 2021 13:44:26 +0530 Subject: [PATCH] DRYer --- src/pyj/read_book/search.pyj | 10 ++-------- src/pyj/read_book/view.pyj | 10 ++++++++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pyj/read_book/search.pyj b/src/pyj/read_book/search.pyj index 94f5ac2d04..ebc4faf74c 100644 --- a/src/pyj/read_book/search.pyj +++ b/src/pyj/read_book/search.pyj @@ -89,16 +89,10 @@ class SearchOverlay: self.view.find(text, backwards) def find_next(self): - if ui_operations.find_next: - ui_operations.find_next(False) - else: - self.find(self.search_text, False) + self.find(self.search_text, False) def find_previous(self): - if ui_operations.find_next: - ui_operations.find_next(True) - else: - self.find(self.search_text, True) + self.find(self.search_text, True) def find_in_serialized_html(data, text): diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index e225ba5dcb..10e5de82a2 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -518,9 +518,15 @@ class View: elif data.name is 'start_search': self.show_search() elif data.name is 'next_match': - self.search_overlay.find_next() + if ui_operations.find_next: + ui_operations.find_next() + else: + self.search_overlay.find_next() elif data.name is 'previous_match': - self.search_overlay.find_previous() + if ui_operations.find_next: + ui_operations.find_next(True) + else: + self.search_overlay.find_previous() elif data.name is 'increase_font_size': self.bump_font_size({'increase': True}) elif data.name is 'decrease_font_size':