[IPython-user] [FWD] Ctrl-Z as EOF
jorgen.stenarson at bostream.nu
Sun Oct 29 10:13:53 CST 2006
I'm a bit puzzled by your problem. A standard install of pyreadline 1.3
or later should have the behaviour you desire as default.
In the beginning of the method emacs_editing_mode in file rlmain.py
there are two calls to the _bind_exit_key method which binds control-d
and control-z as exit keys. An exit key is activated only when the
current line is empty. So it can be a bit dangerous to use the undo with
control-z since using it on an empty line will exit python.
Perhaps you have something in your pyreadlineconfig.ini file that
deactivates this behaviour (there is a possibility to unbind the exit key).
Please let us know if this explains your problems or if you still see
some problems. Because I also think control-z should have the standard
behaviour (even if I personally disable it in my config file).
Fernando Perez skrev:
> Another one forwarded to the list, please note that you need to be subscribed
> to post (we get way too much spam otherwise).
> I'll reply on-list, sorry for the delay, this slipped in a pile of other email.
> # ORIGINAL MESSAGE:
> Ctrl-Z as EOF
> Tim Roberts <timr at probo.com>
> Wed, 18 Oct 2006 15:40:24 -0700
> IPython <ipython-user at scipy.org>
> I thought I had sent this in many months ago, but I do not see it.
> After installing IPython on Win32, one has the benefit of the included
> readline module at all times. However, the readline module causes one
> change in behavior that Win32 Pythoners may find uncomfortable: when
> using the interactive interpreter, Ctrl-Z no longer exits. Instead, it
> is silently eaten up, as an undo with nothing to undo.
> The following patch restores the EOF meaning when the buffer is empty,
> which is the behavior I expect.
> Index: rlmain.py
> --- rlmain.py (revision 1833)
> +++ rlmain.py (working copy)
> @@ -673,6 +673,12 @@
> + def maybe_eof(self, e): # (C-z)
> + '''At start of line, return end of file. Otherwise, undo.'''
> + if len(self.line_buffer) == 0:
> + raise EOFError
> + self.undo(e)
> def backward_delete_char(self, e): # (Rubout)
> '''Delete the character behind the cursor. A numeric argument means
> to kill the characters instead of deleting them.'''
> @@ -1178,7 +1184,7 @@
> self._bind_key('Control-s', self.forward_search_history)
> - self._bind_key('Control-z', self.undo)
> + self._bind_key('Control-z', self.maybe_eof)
> self._bind_key('Control-_', self.undo)
> self._bind_key('Escape', self.prefix_meta)
> self._bind_key('Meta-d', self.kill_word)
> -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc.
> IPython-user mailing list
> IPython-user at scipy.org
More information about the IPython-user