From: terryjreedy Date: Wed, 14 Jun 2017 20:10:10 +0000 (-0400) Subject: [3.6]bpo-15786: Fix IDLE autocomplete return problem. (#2198) (#2199) X-Git-Tag: v3.6.2rc1~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6628006941f4382813a9af4628894c99bb333b8f;p=python [3.6]bpo-15786: Fix IDLE autocomplete return problem. (#2198) (#2199) Before, Enter would not, for instance, complete 're.c' to 're.compile' even with 'compile' highlighted. Now it does. Before, '\n' was inserted into text, which in Shell meant compile() and possibly execute. Now cursor is left after completion. (cherry picked from commit 32fd874afe55e396e3c9a5af35e7bb3d8e0b8f02) --- diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py index e7354d0b95..7c3138f404 100644 --- a/Lib/idlelib/autocomplete_w.py +++ b/Lib/idlelib/autocomplete_w.py @@ -325,8 +325,9 @@ class AutoCompleteWindow: return "break" elif keysym == "Return": + self.complete() self.hide_window() - return None + return 'break' elif (self.mode == COMPLETE_ATTRIBUTES and keysym in ("period", "space", "parenleft", "parenright", "bracketleft",