Backspace key and Arrows in JPython

Martin Pool martinp at mincom.com
Mon Oct 25 02:02:27 EDT 1999


binette wrote:
> 
> I have both Python and JPython installed on my linux box (redhat).
> 
> For some reason I have no problem using the up and down arrows to access
> past command (bash shell style) in Python but can't use 'hem in JPython.
> Same for the Backspace key.

CPython gets command history and editing from the GNU readline native
library.  (So do bash and gdb, for that matter.)  That library isn't
present or accessible in the JVM, so JPython can't do it.

However, I understand that there is a Java port of readline somewhere,
so perhaps it could be patched into JPython.

> Can someone tell me how to do it?

One OK workaround is to run JPython underneath emacs using M-x shell or
M-x py-shell: you then get history and editing done by emacs without the
shell knowing about it.

> (Also, I have no idea how to  fix it (generally) on linux either.  I
> just know that some shells let me do it and others don't)

It's pretty straightforward to patch libreadline into unix apps.

-- 
 /\\\  Mincom | Martin Pool          | martinp at mincom.com
// \\\        | Software Engineer    | Phone: +61 7 3303-3333
\\ ///        | Mincom Ltd.          | 
 \///         | Teneriffe, Brisbane  | Speaking for myself only




More information about the Python-list mailing list