Branch: Tag:

1999-10-04

1999-10-04 00:16:42 by Johan Schön <js@opera.com>

Added session persistent command line history to Hilfe. Stored in /home/js/.hilfe_history.

Rev: lib/modules/Stdio.pmod/Readline.pike:1.27
Rev: lib/modules/Tools.pmod/Hilfe.pmod:1.10

1: - // $Id: Readline.pike,v 1.26 1999/09/10 16:17:59 noring Exp $ + // $Id: Readline.pike,v 1.27 1999/10/04 00:16:42 js Exp $      class OutputController   {
1013:    static private mapping(int:string) historykeep=([]);    static private int minhistory, maxhistory, historynum;    +  array(string) encode() +  { +  return historylist; +  } +     int get_history_num()    {    return historynum;
1062:    maxhistory = maxhist;    }    -  void create(int maxhist) +  void create(int maxhist, void|array(string) hist)    { -  historylist = ({ "" }); +  historylist = hist || ({ "" });    minhistory = historynum = 0;    maxhistory = maxhist;    }
1079:   static private function(string:void) newline_func;   static private int cursorpos = 0;   static private int mark = 0; - static private object(History) historyobj = 0; + /*static private */ object(History) historyobj = 0;   static private int hide = 0;      static private array(string) kill_ring=({});
1408:    output_controller->enable();    insert(data, 0);    int res = input_controller->run_blocking(); +  +     set_nonblocking(oldnl);       if(local_prompt)
1421:    return edit("", prompt);   }    - void enable_history(object(History)|int hist) + void enable_history(array(string)|object(History)|int hist)   {    if (objectp(hist))    historyobj = hist; -  +  else if(arrayp(hist)) +  historyobj = History(512,hist);    else if(!hist)    historyobj = 0;    else if(historyobj)
1433:    historyobj = History(hist);   }    + History get_history() + { +  return historyobj; + } +    void destroy()   {    if(input_controller)