diff -r 4a27b5ab2710 Lib/idlelib/ReplaceDialog.py --- a/Lib/idlelib/ReplaceDialog.py Wed Dec 14 18:40:35 2011 +0100 +++ b/Lib/idlelib/ReplaceDialog.py Sat Dec 17 13:18:31 2011 -0600 @@ -9,7 +9,8 @@ if not hasattr(engine, "_replacedialog"): engine._replacedialog = ReplaceDialog(root, engine) dialog = engine._replacedialog - dialog.open(text) + pat = text.get("sel.first", "sel.last") + dialog.open(text, pat) class ReplaceDialog(SearchDialogBase): @@ -20,19 +21,13 @@ SearchDialogBase.__init__(self, root, engine) self.replvar = StringVar(root) - def open(self, text): + def open(self, text, searchphrase=None): SearchDialogBase.open(self, text) - try: - first = text.index("sel.first") - except TclError: - first = None - try: - last = text.index("sel.last") - except TclError: - last = None - first = first or text.index("insert") - last = last or first - self.show_hit(first, last) + + if searchphrase: + self.ent.delete(0,"end") + self.ent.insert("end",searchphrase) + self.ok = 1 def create_entries(self):