[IPython-dev] [Fwd: Auto-discard notification]

Fernando Perez Fernando.Perez at colorado.edu
Mon Jul 24 20:07:02 EDT 2006

-------- Original Message --------
Subject: Auto-discard notification
Date: Mon, 24 Jul 2006 19:03:19 -0500
From: ipython-dev-bounces at scipy.org
To: ipython-dev-owner at scipy.org

The attached message has been automatically discarded.
Re: [IPython-dev] Multi-line history entries
Jorgen Cederlof <jc at lysator.liu.se>
Tue, 25 Jul 2006 01:59:06 +0200
Vivian De Smedt <vivian at vdesmedt.com>
IPython-dev List <ipython-dev at scipy.net>

On Mon, Jul 24, 2006 at 11:44:39 +0200, Vivian De Smedt wrote:

 >> Hi Jörgen,
 >> I'm very glad that somebody go into that direction. I'm using
 >> windows and the the Python version of readline (pyreadline) and your
 >> patch do not seems to work with this version of the readline
 >> library.
 >> I'm not very used to linux, bach nor with the unix version of the
 >> readline library so I would like to know more about its
 >> functionality to know more about how it is supposed to work and in
 >> particular how it match the behavior I describe in the mail you site
 >> in your mail.
 >> Could you give me more informations or could you point to some
 >> documentations I could read.

The approach in my patch was quite simple. The last part means that if
the current line was a continuation, then the two last entries in
readline's internal history should really be just one entry.
Therefore, remove the last entry and replace the entry before that
with the concatenation of the two entries.

To do that we need the readline.remove_history_item() and
readline.replace_history_item() functions which are new in (Unix
version of) Python 2.4. You can read the documentation at
http://docs.python.org/lib/module-readline.html . I don't know if
anything similar is available for pyreadline.

The first part of the patch is just to feed the auto-indentation code
with one line at a time when entering something that spans over
several lines, otherwise it fails to auto-indent the next line.

Anyway, the user-visible difference the patch makes is just that when
you step or search through the history, an expression that spans
several lines will be shown as a single entry spanning several lines
instead of one entry for each line. The rest of the screen will scroll
as much as needed to make place for the multi-line entry. That is
probably quite different from your suggestion. To move around in it
you can unfortunately not use up-arrow and down-arrow, since that will
just move you to another history entry.

If you ever find a way to try bash, you will find that it behaves the
same way. zsh is different, in zsh those keys move the cursor inside a
multi-line entry if possible and only move to the previous/next entry
if the cursor is at the top/bottom line. That behaviour should be much
better for a Python shell.

-------------- next part --------------
An embedded message was scrubbed...
From: Jorgen Cederlof <jc at lysator.liu.se>
Subject: Re: [IPython-dev] Multi-line history entries
Date: Tue, 25 Jul 2006 01:59:06 +0200
Size: 4007
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20060724/939bc43f/attachment.eml>

More information about the IPython-dev mailing list