summaryrefslogtreecommitdiffstats
path: root/Tools/idle/SearchDialog.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-01-28 19:04:01 (GMT)
committerGuido van Rossum <guido@python.org>1999-01-28 19:04:01 (GMT)
commit959c937382bca0754fed41bb46695d9438655271 (patch)
tree010c5ac7709cc11ed2d3e35a3f5255b9b35c41df /Tools/idle/SearchDialog.py
parent3d58bcd5d9bae31ac02c738456d9720b94d20dd0 (diff)
downloadcpython-959c937382bca0754fed41bb46695d9438655271.zip
cpython-959c937382bca0754fed41bb46695d9438655271.tar.gz
cpython-959c937382bca0754fed41bb46695d9438655271.tar.bz2
When find_again() finds exactly the current selection, it's a failure.
Diffstat (limited to 'Tools/idle/SearchDialog.py')
-rw-r--r--Tools/idle/SearchDialog.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Tools/idle/SearchDialog.py b/Tools/idle/SearchDialog.py
index 501b6d0..0f0cb18 100644
--- a/Tools/idle/SearchDialog.py
+++ b/Tools/idle/SearchDialog.py
@@ -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)