[meld/ui-next] ui.findbar: Make find next/prev not show the find bar



commit c366ef4b4290be28fbccf2a7423c46e3e745b861
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Mon Mar 11 06:23:22 2019 +1000

    ui.findbar: Make find next/prev not show the find bar
    
    Our find next/previous actions had a somewhat odd behaviour where they'd
    cause the find bar to be shown if we didn't have search text. This isn't
    behaviour that I've found in other similar apps, so it's probably best
    that we stop doing it.
    
    This also removes some slightly weird assertion handling around our
    internal find-the-text helper.

 meld/ui/findbar.py | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/meld/ui/findbar.py b/meld/ui/findbar.py
index 6fa36195..729cfec1 100644
--- a/meld/ui/findbar.py
+++ b/meld/ui/findbar.py
@@ -93,17 +93,11 @@ class FindBar(Gtk.Grid):
 
     def start_find_next(self, textview):
         self.set_text_view(textview)
-        if self.find_entry.get_text():
-            self.on_find_next_button_clicked(self.find_next_button)
-        else:
-            self.start_find(self.textview)
+        self._find_text()
 
-    def start_find_previous(self, textview, text=None):
+    def start_find_previous(self, textview):
         self.set_text_view(textview)
-        if self.find_entry.get_text():
-            self.on_find_previous_button_clicked(self.find_previous_button)
-        else:
-            self.start_find(self.textview)
+        self._find_text(backwards=True)
 
     def start_replace(self, textview, text=None):
         self.replace_mode = True
@@ -160,8 +154,9 @@ class FindBar(Gtk.Grid):
         self.hide()
 
     def _find_text(self, start_offset=1, backwards=False):
-        assert self.textview
-        assert self.search_context
+        if not self.textview or not self.search_context:
+            return
+
         buf = self.textview.get_buffer()
         insert = buf.get_iter_at_mark(buf.get_insert())
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]