pike.git / lib / modules / Stdio.pmod / Readline.pmod

version» Context lines:

pike.git/lib/modules/Stdio.pmod/Readline.pmod:1: - // $Id: Readline.pmod,v 1.2 1999/03/14 01:33:20 marcus Exp $ + // $Id: Readline.pmod,v 1.3 1999/03/14 01:42:24 marcus Exp $      class OutputController   {    static private object outfd, term;    static private int xpos = 0, columns = 0;       void check_columns()    {    catch {    int c = outfd->tcgetattr()->columns;
pike.git/lib/modules/Stdio.pmod/Readline.pmod:856:       void eof()    {    if (historyobj)    historyobj->finishline(text);    initline();    if(newline_func)    newline_func(0);    }    +  void message(string msg) +  { +  int p = cursorpos; +  setcursorpos(strlen(text)); +  output_controller->newline(); +  foreach(msg/"\n", string l) { +  output_controller->write(l); +  output_controller->newline(); +  } +  redisplay(0, 1); +  setcursorpos(p); +  } +  +  void list_completions(array(string) c) +  { +  message(sprintf("%-"+output_controller->get_number_of_columns()+"#s", +  c*"\n")); +  } +     static private void read_newline(string s)    {    input_controller->disable();    readtext = s;    }       void set_nonblocking(function f)    {    if (newline_func = f)    input_controller->enable();
pike.git/lib/modules/Stdio.pmod/Readline.pmod:950:    compl += ({ c });    switch(sizeof(compl)) {    case 0:    break;    case 1:    rl->delete(point-sizeof(word), point);    rl->insert(compl[0], point-sizeof(word));    rl->setcursorpos(point-sizeof(word)+sizeof(compl[0]));    break;    default: -  rl->setcursorpos(strlen(rl->gettext())); -  rl->get_output_controller()->newline(); -  foreach(sprintf("%-"+rl->get_output_controller()-> -  get_number_of_columns()+"#s", compl*"\n") -  /"\n", string l) { -  rl->get_output_controller()->write(l); -  rl->get_output_controller()->newline(); +  rl->list_completions(compl); +  break;    } -  rl->redisplay(0, 1); -  rl->setcursorpos(point); -  } +     });    string res = rl->read();    destruct(rl);    return res;   }