[issue15786] IDLE code completion window can hang or misbehave with mouse

Terry J. Reedy report at bugs.python.org
Wed Jun 14 16:10:53 EDT 2017


Terry J. Reedy added the comment:

With the severe click bug apparently fixed, I focused on Suddha Sourav last sentence "In addition, pressing enter does not autocomplete but execute what was meant to be selected."  In current freshly started IDLE, for example

>>> re.c<^-space>

brings up a box with [compile] highlighted.  On hitting <Return> one sees

>>> re.c
...
NameError: name 're' is not defined

'c' has not been completed to 'compile' and \n has been inserted into the Text widget, causing the line (in the shell) to be compiled and executed.  I imagine that everyone would prefer ">>> re.compile" with the cursor at the end.  The fix is so simple that I decided to include it here, today.  In autocomplete_w.AutoCompleteWindow.keypress_event, change
        elif keysym == "Return":
            self.hide_window()
            return None
to
        elif keysym == "Return":
            self.complete()
            self.hide_window()
            return 'break'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15786>
_______________________________________


More information about the Python-bugs-list mailing list