]> granicus.if.org Git - python/commitdiff
[3.6]bpo-15786: Fix IDLE autocomplete return problem. (#2198) (#2199)
authorterryjreedy <tjreedy@udel.edu>
Wed, 14 Jun 2017 20:10:10 +0000 (16:10 -0400)
committerGitHub <noreply@github.com>
Wed, 14 Jun 2017 20:10:10 +0000 (16:10 -0400)
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)

Lib/idlelib/autocomplete_w.py

index e7354d0b95ba5a8157c959d87b663c39cd9c0933..7c3138f4040a307d4cb59f01b6938a31365600ac 100644 (file)
@@ -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",