Karim Belabas on Wed, 21 Jul 2004 16:07:44 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: readline question


* Igor Schein [2004-05-19 19:40]:
> Hi,
> 
> I run gp inside a screen session, and I detach/reattach to the session
> from different terminals, varying in size.  Sometimes gp becomes
> confused about the width of the window.  For example, right now I have
> a session where I can only type 144-long lines before it wraps
> around.  However, if I ^Z, the underlying shell shows 264 columns (
> which is the width of my current screen ).  Is there a magic readline
> command which would make gp session re-learn the terminal size?  I
> tried many things, like ^A-F ( screen command ), eval `resize`, reset,
> tset etc., nothing works.  My command lines can be 500-characters
> long, and editing became a nightmare, but on the other hand I don't
> wanna lose 1000+ line history of the current gp session.  

I have no clue about this one.

> I was also unable to find a readline-native way to save out a command
> history to a file.  If such functionality doesn't exists, maybe it
> would be doable to add 'history' command for gp?  All modern shells
> have a history command, and gp is a shell by definition.

Here's one possible implementation :

  install( write_history, vs, history, "libreadline.so" )
  history( "some_history_file" )

This one cheats to pass a NULL argument ( and writes to $HOME/.history ):

  install( write_history, "vD0,L," , history, "libreadline.so" )
  history()

Cheers,

    Karim.
-- 
Karim Belabas                     Tel: (+33) (0)1 69 15 57 48
Dep. de Mathematiques, Bat. 425   Fax: (+33) (0)1 69 15 60 19
Universite Paris-Sud              http://www.math.u-psud.fr/~belabas/
F-91405 Orsay (France)            http://pari.math.u-bordeaux.fr/  [PARI/GP]