When find_again() finds exactly the current selection, it's a failure.
authorGuido van Rossum <guido@python.org>
Thu, 28 Jan 1999 19:04:01 +0000 (19:04 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 28 Jan 1999 19:04:01 +0000 (19:04 +0000)
Tools/idle/SearchDialog.py

index 501b6d0067a37cd49fa180b8cbcf8760ad4fcd30..0f0cb189f6b7ed5db5c4d3c08d7954b6dcf275e2 100644 (file)
@@ -43,6 +43,14 @@ class SearchDialog(SearchDialogBase):
             i, j = m.span()
             first = "%d.%d" % (line, i)
             last = "%d.%d" % (line, j)
+            try:
+                selfirst = text.index("sel.first")
+                sellast = text.index("sel.last")
+                if selfirst == first and sellast == last:
+                    text.bell()
+                    return 0
+            except TclError:
+                pass
             text.tag_remove("sel", "1.0", "end")
             text.tag_add("sel", first, last)
             text.mark_set("insert", self.engine.isback() and first or last)