]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
By default when getting the search menu, the currently highligted
authorChui Tey <chui.tey@advdata.com.au>
Wed, 6 Nov 2002 02:18:45 +0000 (02:18 +0000)
committerChui Tey <chui.tey@advdata.com.au>
Wed, 6 Nov 2002 02:18:45 +0000 (02:18 +0000)
text is the search term.

Lib/idlelib/SearchDialog.py
Lib/idlelib/SearchDialogBase.py

index 8d275c4437b6cf1316e4116e93fc2df74c2ecc06..d7124d67ff2a2fab60f63b1a1fe266cd0c2f1dd1 100644 (file)
@@ -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)
index 3556ebf69f3be0ca786dea272f647298bc053910..c2a59c5d21c5ae4bee6cddfac61f4ad4d9a1d350 100644 (file)
@@ -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)