mirror of https://github.com/python/cpython.git
By default when getting the search menu, the currently highligted
text is the search term.
This commit is contained in:
parent
110aa50cc2
commit
5a231c8f79
|
@ -11,7 +11,8 @@ def _setup(text):
|
||||||
return engine._searchdialog
|
return engine._searchdialog
|
||||||
|
|
||||||
def find(text):
|
def find(text):
|
||||||
return _setup(text).open(text)
|
pat = text.get("sel.first", "sel.last")
|
||||||
|
return _setup(text).open(text,pat)
|
||||||
|
|
||||||
def find_again(text):
|
def find_again(text):
|
||||||
return _setup(text).find_again(text)
|
return _setup(text).find_again(text)
|
||||||
|
|
|
@ -11,13 +11,16 @@ def __init__(self, root, engine):
|
||||||
self.engine = engine
|
self.engine = engine
|
||||||
self.top = None
|
self.top = None
|
||||||
|
|
||||||
def open(self, text):
|
def open(self, text, searchphrase=None):
|
||||||
self.text = text
|
self.text = text
|
||||||
if not self.top:
|
if not self.top:
|
||||||
self.create_widgets()
|
self.create_widgets()
|
||||||
else:
|
else:
|
||||||
self.top.deiconify()
|
self.top.deiconify()
|
||||||
self.top.tkraise()
|
self.top.tkraise()
|
||||||
|
if searchphrase:
|
||||||
|
self.ent.delete(0,"end")
|
||||||
|
self.ent.insert("end",searchphrase)
|
||||||
self.ent.focus_set()
|
self.ent.focus_set()
|
||||||
self.ent.selection_range(0, "end")
|
self.ent.selection_range(0, "end")
|
||||||
self.ent.icursor(0)
|
self.ent.icursor(0)
|
||||||
|
|
Loading…
Reference in New Issue