From: Kurt B. Kaiser Date: Thu, 14 Feb 2008 04:19:41 +0000 (+0000) Subject: Assume that the user knows when he wants to end the line; don't insert X-Git-Tag: v2.5.2c1~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2fbad0e99bf581dc8e5e3afa8253765ebafd9493;p=python Assume that the user knows when he wants to end the line; don't insert something he didn't select or complete. Backport r58306 --- diff --git a/Lib/idlelib/AutoComplete.py b/Lib/idlelib/AutoComplete.py index 7085386621..e1549be838 100644 --- a/Lib/idlelib/AutoComplete.py +++ b/Lib/idlelib/AutoComplete.py @@ -27,7 +27,7 @@ class AutoComplete: menudefs = [ ('edit', [ - ("Show completions", "<>"), + ("Show Completions", "<>"), ]) ] diff --git a/Lib/idlelib/AutoCompleteWindow.py b/Lib/idlelib/AutoCompleteWindow.py index 9cdb830bf7..be4150db32 100644 --- a/Lib/idlelib/AutoCompleteWindow.py +++ b/Lib/idlelib/AutoCompleteWindow.py @@ -274,20 +274,9 @@ class AutoCompleteWindow: self._selection_changed() return "break" - elif keysym == "Return" and not state: - # 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() - return + elif keysym == "Return": + self.hide_window() + return elif (self.mode == AutoComplete.COMPLETE_ATTRIBUTES and keysym in ("period", "space", "parenleft", "parenright", "bracketleft",