summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/idlelib/SearchDialog.py3
-rw-r--r--Lib/idlelib/SearchDialogBase.py5
2 files changed, 6 insertions, 2 deletions
diff --git a/Lib/idlelib/SearchDialog.py b/Lib/idlelib/SearchDialog.py
index 8d275c4..d7124d6 100644
--- a/Lib/idlelib/SearchDialog.py
+++ b/Lib/idlelib/SearchDialog.py
@@ -11,7 +11,8 @@ def _setup(text):
return engine._searchdialog
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):
return _setup(text).find_again(text)
diff --git a/Lib/idlelib/SearchDialogBase.py b/Lib/idlelib/SearchDialogBase.py
index 3556ebf..c2a59c5 100644
--- a/Lib/idlelib/SearchDialogBase.py
+++ b/Lib/idlelib/SearchDialogBase.py
@@ -11,13 +11,16 @@ class SearchDialogBase:
self.engine = engine
self.top = None
- def open(self, text):
+ def open(self, text, searchphrase=None):
self.text = text
if not self.top:
self.create_widgets()
else:
self.top.deiconify()
self.top.tkraise()
+ if searchphrase:
+ self.ent.delete(0,"end")
+ self.ent.insert("end",searchphrase)
self.ent.focus_set()
self.ent.selection_range(0, "end")
self.ent.icursor(0)