Re: readline() with editing and history?



On Sat, Sep 16, 2006 at 01:58:27AM +0900, Kent Sibilev wrote:
On 9/15/06, Josef Wolf <jw@xxxxxxxxxxxxx> wrote:
I'm looking for a readline() with history and editing support (like perl's
Term::Readline). Does such a thing exist for ruby?

require 'readline'

It comes with Ruby.

Thanks for your quick reply, Kent! But somehow I don't get it:

jw@raven> irb
irb(main):001:0> require 'readline'
=> false
irb(main):002:0> readline
asdf^[[D^[[D^[[A^[[A
=> "asdf\e[D\e[D\e[A\e[A\n"

The ^[[D is the result of the up-arrow and ^[[A is the result of the
left-arrow. "ri readline" mentiones:

IO::readlines, IO#readline, IO#readlines, Kernel#readlines,
Kernel#readline, Pathname#readlines, Zlib::GzipReader#readline,
Zlib::GzipReader#readlines

But none of them seem to support line-editing or history. :-(

Any idea what is going wrong here?

.



Relevant Pages

  • Re: Parsing excel CVS data on a mac OSX to extract blocks of cells
    ... > I thought I could use readlines and a puts and then copy the ruby ... There's a few ways to handle converting newlines between O/S: ... IO#gets, readline, each_line etc. ...
    (comp.lang.ruby)
  • Re: Detecting Arrow Keys
    ... Isn't readline already distributed with ruby by default? ... The implementations of readline available on windows are broken, ... starting from around about character ... actually doesn't violate POLS. ...
    (comp.lang.ruby)
  • Building Ruby on HPUX + readline support
    ... I have successfully managed to build Ruby 1.8.6 on HP-UX, ... that I need to rebuild Ruby with readline support enabled. ... It when compiling readline failed with the following ... *** Error exit code 1 ...
    (comp.lang.ruby)
  • Error on ruby readline
    ... I just compile ruby readline ext for ruby 1.8.6-p110 now. ... all my special character is not recognize by irb, ... I don't have the tgetnum() function, ...
    (comp.lang.ruby)
  • Re: setting up ruby on os x 10.2
    ... Doing that gave me a new Ruby 1.8.2 a new gems version readline in irb, and an easy way to keep things up to date. ...
    (comp.lang.ruby)