Tab and arrow-keys in gets

Discussion in 'Ruby' started by Magnus Holm, Feb 20, 2007.

  1. Magnus Holm

    Magnus Holm Guest

    Hi!

    I'm making a simple Ruby shell. It's all basing on an endless
    while-loop and $stdin.gets. But here (on my Linux box) I cannot use
    the arrow key. It just shows: "^[[A". And it would be great too have a
    tab-feature.

    But how do you implement these features?
    Magnus Holm, Feb 20, 2007
    #1
    1. Advertising

  2. On 2/21/07, Magnus Holm <> wrote:
    > Hi!
    >
    > I'm making a simple Ruby shell. It's all basing on an endless
    > while-loop and $stdin.gets. But here (on my Linux box) I cannot use
    > the arrow key. It just shows: "^[[A". And it would be great too have a
    > tab-feature.
    >
    > But how do you implement these features?


    require 'readline'

    while line = Readline.readline('foo> ', true)
    puts "You gave me: #{line}"
    end

    Have fun :)

    Some (very) basic docs are at:
    http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/readline/README?view=markup
    Michael Fellinger, Feb 21, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jitrowia
    Replies:
    2
    Views:
    372
    Dennis Lee Bieber
    Jan 26, 2008
  2. Bob Morvay

    Arrow keys and the datagrid...

    Bob Morvay, Apr 28, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    164
    Bob Morvay
    Apr 29, 2005
  3. Andrus

    Replace Up Arrow with Shift+Tab

    Andrus, Jun 29, 2003, in forum: Javascript
    Replies:
    0
    Views:
    100
    Andrus
    Jun 29, 2003
  4. pazabo

    Arrow keys and onkeypress

    pazabo, Mar 25, 2007, in forum: Javascript
    Replies:
    1
    Views:
    104
    Evertjan.
    Mar 25, 2007
  5. sylver
    Replies:
    4
    Views:
    185
    sylver
    Aug 2, 2007
Loading...

Share This Page