[pyrepl-checkins] r43378 - pyrepl/trunk/pyrepl/pyrepl

arigo at codespeak.net arigo at codespeak.net
Mon May 14 19:24:04 CEST 2007


Author: arigo
Date: Mon May 14 19:24:03 2007
New Revision: 43378

Modified:
   pyrepl/trunk/pyrepl/pyrepl/commands.py
Log:
As discussed on #pypy: the up key should move into the previous
history item when pressed on the first line of the input buffer,
and symmetrically for the down key.  This should give a feeling
of the up/down key going through all the *lines* entered so far.

(An experimental check-in, feel free to revert.)


Modified: pyrepl/trunk/pyrepl/pyrepl/commands.py
==============================================================================
--- pyrepl/trunk/pyrepl/pyrepl/commands.py	(original)
+++ pyrepl/trunk/pyrepl/pyrepl/commands.py	Mon May 14 19:24:03 2007
@@ -203,6 +203,9 @@
         for i in range(r.get_arg()):
             bol1 = r.bol()
             if bol1 == 0:
+                if r.historyi > 0:
+                    r.select_item(r.historyi - 1)
+                    return
                 r.pos = 0
                 r.error("start of buffer")
                 return
@@ -222,6 +225,10 @@
             bol1 = r.bol()
             eol1 = r.eol()
             if eol1 == len(b):
+                if r.historyi < len(r.history):
+                    r.select_item(r.historyi + 1)
+                    r.pos = r.eol(0)
+                    return
                 r.pos = len(b)
                 r.error("end of buffer")
                 return


More information about the pyrepl-checkins mailing list