[meld: 1/4] Add cache to findbar to remember previous search
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld: 1/4] Add cache to findbar to remember previous search
- Date: Sat, 16 Jan 2021 22:49:13 +0000 (UTC)
commit ed45ece21a2da8d98e87d98deaedf609ad0285aa
Author: Jack <jack vanier16 outlook com>
Date: Tue Jan 12 20:48:42 2021 -0500
Add cache to findbar to remember previous search
meld/ui/findbar.py | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/meld/ui/findbar.py b/meld/ui/findbar.py
index 66d88c1b..966bf3c7 100644
--- a/meld/ui/findbar.py
+++ b/meld/ui/findbar.py
@@ -16,6 +16,8 @@
from gi.repository import GObject, Gtk, GtkSource
+_cache = None # Global variable to hold the most recent searched for text
+
@Gtk.Template(resource_path='/org/gnome/meld/ui/findbar.ui')
class FindBar(Gtk.Grid):
@@ -101,10 +103,14 @@ class FindBar(Gtk.Grid):
self.search_context = None
def start_find(self, *, textview: Gtk.TextView, replace: bool, text: str):
+ global _cache
self.replace_mode = replace
self.set_text_view(textview)
if text:
self.find_entry.set_text(text)
+ _cache = text
+ elif _cache:
+ self.find_entry.set_text(_cache)
self.show()
self.find_entry.grab_focus()
@@ -154,6 +160,8 @@ class FindBar(Gtk.Grid):
@Gtk.Template.Callback()
def on_find_entry_changed(self, entry):
+ global _cache
+ _cache = entry.get_text()
self._find_text(0)
@Gtk.Template.Callback()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]