From: Rick DeNatale Date: 2006-09-16T06:42:24+09:00 Subject: Re: readline() with editing and history? On 9/15/06, Josef Wolf wrote: > On Sat, Sep 16, 2006 at 01:58:27AM +0900, Kent Sibilev wrote: > > On 9/15/06, Josef Wolf 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? My guess is that your installation of Ruby didn't successfully install the readline extension. The following is based on linux, if you are are on Windows or Mac, things might be different. How did you install Ruby? If you installed it as a package then you might need a separate package to get readline, for example debian/ubuntu has a separate libreadline-ruby package. If you installed ruby from source, then readline probably didn't build when you built ruby because you don't have the required source files for the interfaces to the readline library, in which case you need to figure out what you need and rebuild the readline extension. If this is the case come back and we can probably work you through it. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/