summaryrefslogtreecommitdiff
path: root/Lib/idlelib/AutoCompleteWindow.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2008-02-14 04:02:10 +0000
committerKurt B. Kaiser <kbk@shore.net>2008-02-14 04:02:10 +0000
commit1df323a196a8cb6db34e06c999797544ebafec22 (patch)
tree547a7c08ab95aa8845072d218be574882bdba531 /Lib/idlelib/AutoCompleteWindow.py
parent6493ade54db699f22cb309024e1d1a93cb509484 (diff)
downloadcpython-git-1df323a196a8cb6db34e06c999797544ebafec22.tar.gz
1. Avoid hang when encountering a duplicate in a completion list. Bug 1571112.
2. Duplicate some old entries from Python's NEWS to IDLE's NEWS.txt Backport of r53042
Diffstat (limited to 'Lib/idlelib/AutoCompleteWindow.py')
-rw-r--r--Lib/idlelib/AutoCompleteWindow.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/idlelib/AutoCompleteWindow.py b/Lib/idlelib/AutoCompleteWindow.py
index d8bbff4a17..d02a69539a 100644
--- a/Lib/idlelib/AutoCompleteWindow.py
+++ b/Lib/idlelib/AutoCompleteWindow.py
@@ -118,8 +118,11 @@ class AutoCompleteWindow:
i = 0
while i < len(lts) and i < len(selstart) and lts[i] == selstart[i]:
i += 1
- while cursel > 0 and selstart[:i] <= self.completions[cursel-1]:
+ previous_completion = self.completions[cursel - 1]
+ while cursel > 0 and selstart[:i] <= previous_completion:
i += 1
+ if selstart == previous_completion:
+ break # maybe we have a duplicate?
newstart = selstart[:i]
self._change_start(newstart)