diff -r b891bf435f69 Lib/idlelib/SearchDialog.py --- a/Lib/idlelib/SearchDialog.py Fri Apr 05 16:21:39 2013 +0300 +++ b/Lib/idlelib/SearchDialog.py Sun Apr 07 22:55:18 2013 -0400 @@ -1,5 +1,4 @@ from Tkinter import * - from idlelib import SearchEngine from idlelib.SearchDialogBase import SearchDialogBase @@ -29,8 +28,23 @@ def default_command(self, event=None): if not self.engine.getprog(): return - if self.find_again(self.text): - self.close() + self.find_again(self.text) + + def show_hit(self, first, last): + try: + text = self.text + text.mark_set("insert", first) + text.tag_remove("sel", "1.0", "end") + text.tag_add("sel", first, last) + text.tag_remove("hit", "1.0", "end") + if first == last: + text.tag_add("hit", first) + else: + text.tag_add("hit", first, last) + text.see("insert") + text.update_idletasks() + except Exception: + pass def find_again(self, text): if not self.engine.getpat(): @@ -56,6 +70,7 @@ text.tag_add("sel", first, last) text.mark_set("insert", self.engine.isback() and first or last) text.see("insert") + self.show_hit(first, last) return True else: text.bell() @@ -66,3 +81,7 @@ if pat: self.engine.setcookedpat(pat) return self.find_again(text) + + def close(self, event=None): + SearchDialogBase.close(self, event) + self.text.tag_remove("hit", "1.0", "end")