Skip to content

Ctrl-C doesn't work to clear a line of input when using wx #122

Open
ellisonbg opened this Issue May 20, 2010 · 3 comments

4 participants

@ellisonbg
IPython member

In previous versions of IPython, you could use Ctrl-C to clear a line of input. This no longer works if GUI event loop integration is running with wx or qt. This is because of how the wx and qt inputhooks handle KeyboardInterrupt. But, this does work in Tk, which means it is possible to fix this issue. We need to investigate and fix.

@takluyver
IPython member

Confirmed in trunk.

@ellisonbg ellisonbg was assigned Apr 10, 2011
@cboos
cboos commented Oct 9, 2011

For a possible fix for the qt side of this issue, see #815 and in particular 6ab38c6 and fa66348.

@cboos cboos added a commit to cboos/ipython that referenced this issue Oct 11, 2011
@cboos cboos inputhook: move the new CTRL+C handling logic to this level
The inputhookqt4 module now only contains a simple, straightforward
inputhook_qt4 input hook doing only Qt4 event processing in short
batches (#481).

The logic to handle CTRL+C is now entirely done at the level of the
InputHookManager, where a new set_safe_inputhook() method can be used
to install a hook which will automatically benefit of the two-step
CTRL+C handling (first for interrupting the event loop and suspending
the input hook, second for returning to the prompt, at which point the
input hook is restored). This should help to address issues #122 and
catch KeyboardInterrupt and has to be installed using
set_safe_inputhook).

Some extra care is taken on Unix where we want to make sure no
KeyboardInterrupt is raised upon entering the Python callback (e.g. in
readline.c, if a KeyboardInterrupt is received during a select(), the
PyOS_InputHook is executed directly afterward and if it's a ctypes
Python callback the exception will be raised immediately on entering
the function, even before an initial `try:` could be executed).
1d6e9a0
@minrk minrk changed the title from Ctrl-C doesn't work to clear a line of input when using wx or qt to Ctrl-C doesn't work to clear a line of input when using wx Nov 11, 2014
@minrk
IPython member
minrk commented Nov 11, 2014

This is fixed in Qt, not Wx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.