[IPython-User] Making Control-D work when the line is not clear
Tue Oct 18 22:10:07 CDT 2011
On Tue, Oct 18, 2011 at 9:00 PM, Fernando Perez <firstname.lastname@example.org> wrote:
> On Tue, Oct 18, 2011 at 7:08 PM, Aaron Meurer <email@example.com> wrote:
>> Maybe I'm mistaken, but wouldn't it have to be IPython to do it, since
>> the callback would have to run separately in a different process (like
>> on the kernel or something)?
> The point is that the readline api is pretty simple and doesn't offer
> a way to hook arbitrary code to key events in general. It only offers
> a few specific calls, mostly of its own implementation, that you can
> configure. So I don't know how to begin hooking IPython in there...
> Perhaps I've totally misunderstood your question though, if that's the
> case try to rephrase it in one shot :)
No, I think you understood correctly. In order to do more fancy
stuff, you'd have to basically reimplement readline (using curses or
By the way, I just realized you can avoid clearing the current yank
buffer in my workaround by doing instead "\\C-a\\C-k\\C-d". Thanks
for your help, and hopefully my solution will help someone else who
wants this behavior.
>> Anyway, maybe it's something to think about for the QT console, where
>> you have more control over these things.
> There, we *do* have full event handling control, and something like
> that can certainly be considered.
More information about the IPython-User