Assume that the user knows when he wants to end the line; don't insert

something he didn't select or complete.
Backport r58306
This commit is contained in:
Kurt B. Kaiser 2008-02-14 04:19:41 +00:00
parent 60d9f8df38
commit 2fbad0e99b
2 changed files with 4 additions and 15 deletions

View File

@ -27,7 +27,7 @@ class AutoComplete:
menudefs = [ menudefs = [
('edit', [ ('edit', [
("Show completions", "<<force-open-completions>>"), ("Show Completions", "<<force-open-completions>>"),
]) ])
] ]

View File

@ -274,18 +274,7 @@ class AutoCompleteWindow:
self._selection_changed() self._selection_changed()
return "break" return "break"
elif keysym == "Return" and not state: elif keysym == "Return":
# If start is a prefix of the selection, or there was an indication
# that the user used the completion window, put the selected
# completion in the text, and close the list.
# Otherwise, close the window and let the event through.
cursel = int(self.listbox.curselection()[0])
if self.completions[cursel][:len(self.start)] == self.start or \
self.userwantswindow:
self._change_start(self.completions[cursel])
self.hide_window()
return "break"
else:
self.hide_window() self.hide_window()
return return