mirror of https://github.com/python/cpython
Issue #18988: The "Tab" key now works when a word is already autocompleted.
This commit is contained in:
commit
fa7d3b13a3
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue