summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-09-11 22:46:27 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2013-09-11 22:46:27 +0300
commitca865fb77681626f82fc26b69c1e7e4f53de9b87 (patch)
tree25471e878ddd0def4baed8979b71249bb281395a
parent979a42a6e14edb23e1f5277256e35f2e6ad13c77 (diff)
downloadcpython-ca865fb77681626f82fc26b69c1e7e4f53de9b87.tar.gz
Issue #18988: The "Tab" key now works when a word is already autocompleted.
-rw-r--r--Lib/idlelib/AutoComplete.py9
-rw-r--r--Lib/idlelib/AutoCompleteWindow.py3
-rw-r--r--Misc/NEWS2
3 files changed, 7 insertions, 7 deletions
diff --git a/Lib/idlelib/AutoComplete.py b/Lib/idlelib/AutoComplete.py
index 929d3581c9..f3660307d3 100644
--- a/Lib/idlelib/AutoComplete.py
+++ b/Lib/idlelib/AutoComplete.py
@@ -160,12 +160,9 @@ class AutoComplete:
if not comp_lists[0]:
return
self.autocompletewindow = self._make_autocomplete_window()
- self.autocompletewindow.show_window(comp_lists,
- "insert-%dc" % len(comp_start),
- complete,
- mode,
- userWantsWin)
- return True
+ return not self.autocompletewindow.show_window(
+ comp_lists, "insert-%dc" % len(comp_start),
+ complete, mode, userWantsWin)
def fetch_completions(self, what, mode):
"""Return a pair of lists of completions for something. The first list
diff --git a/Lib/idlelib/AutoCompleteWindow.py b/Lib/idlelib/AutoCompleteWindow.py
index 7787e7034c..f666ea628b 100644
--- a/Lib/idlelib/AutoCompleteWindow.py
+++ b/Lib/idlelib/AutoCompleteWindow.py
@@ -157,13 +157,14 @@ class AutoCompleteWindow:
self.start = self.widget.get(self.startindex, "insert")
if complete:
completed = self._complete_string(self.start)
+ start = self.start
self._change_start(completed)
i = self._binary_search(completed)
if self.completions[i] == completed and \
(i == len(self.completions)-1 or
self.completions[i+1][:len(completed)] != completed):
# There is exactly one matching completion
- return
+ return completed == start
self.userwantswindow = userWantsWin
self.lasttypedstart = self.start
diff --git a/Misc/NEWS b/Misc/NEWS
index 51e055786e..dcd97540e7 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -293,6 +293,8 @@ C API
IDLE
----
+- Issue #18988: The "Tab" key now works when a word is already autocompleted.
+
- Issue #18489: Add tests for SearchEngine. Original patch by Phil Webster.
- Issue #18429: Format / Format Paragraph, now works when comment blocks