[Python-checkins] cpython (2.7): Issue #18988: The "Tab" key now works when a word is already autocompleted.

serhiy.storchaka python-checkins at python.org
Wed Sep 11 22:00:21 CEST 2013


http://hg.python.org/cpython/rev/8d320204d5d6
changeset:   85659:8d320204d5d6
branch:      2.7
parent:      85653:443d12b61e5b
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Sep 11 22:49:06 2013 +0300
summary:
  Issue #18988: The "Tab" key now works when a word is already autocompleted.

files:
  Lib/idlelib/AutoComplete.py       |  9 +++------
  Lib/idlelib/AutoCompleteWindow.py |  3 ++-
  Misc/NEWS                         |  2 ++
  3 files changed, 7 insertions(+), 7 deletions(-)


diff --git a/Lib/idlelib/AutoComplete.py b/Lib/idlelib/AutoComplete.py
--- a/Lib/idlelib/AutoComplete.py
+++ b/Lib/idlelib/AutoComplete.py
@@ -156,12 +156,9 @@
         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
--- a/Lib/idlelib/AutoCompleteWindow.py
+++ b/Lib/idlelib/AutoCompleteWindow.py
@@ -157,13 +157,14 @@
         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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -191,6 +191,8 @@
 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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list