Commit a7a8b132 authored by Kai Willadsen's avatar Kai Willadsen

Pre-fill the findbar Find entry with the selected text

parent c3ea8df3
......@@ -885,11 +885,13 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
return None
def on_find_activate(self, *args):
self.findbar.start_find( self.textview_focussed )
selected_text = self.get_selected_text()
self.findbar.start_find(self.textview_focussed, selected_text)
self.keymask = 0
def on_replace_activate(self, *args):
self.findbar.start_replace( self.textview_focussed )
selected_text = self.get_selected_text()
self.findbar.start_replace(self.textview_focussed, selected_text)
self.keymask = 0
def on_find_next_activate(self, *args):
......
......@@ -32,12 +32,14 @@ class FindBar(gnomeglade.Component):
self.textview = None
self.widget.hide()
def start_find(self, textview):
def start_find(self, textview, text=None):
self.textview = textview
self.replace_label.hide()
self.replace_entry.hide()
self.replace_button.hide()
self.replace_all_button.hide()
if text:
self.find_entry.set_text(text)
self.widget.show()
self.find_entry.grab_focus()
......@@ -48,15 +50,17 @@ class FindBar(gnomeglade.Component):
else:
self.start_find(self.textview)
def start_find_previous(self, textview):
def start_find_previous(self, textview, text=None):
self.textview = textview
if self.find_entry.get_text():
self.find_previous_button.activate()
else:
self.start_find(self.textview)
def start_replace(self, textview):
def start_replace(self, textview, text=None):
self.textview = textview
if text:
self.find_entry.set_text(text)
self.widget.show_all()
self.find_entry.grab_focus()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment