R
Roger Pack
It would be quite convenient to have a getch method in Ruby.
Any opposition to my suggesting its addition to core?
-r
Any opposition to my suggesting its addition to core?
-r
Roger said:It would be quite convenient to have a getch method in Ruby.
Any opposition to my suggesting its addition to core?
-r
$ /usr/local/bin/ruby-1.9.3 -v -rio/console -e 'p STDIN.gets; p
STDIN.noecho{|f|f.gets("!")}; p STDIN.getch'
ruby 1.9.3dev (2010-07-06 trunk 28554) [x86_64-linux]
hello
"hello\n"
"world!"
"\n"
$ /usr/local/bin/ruby-1.9.3 -v -rio/console -e 'p STDIN.gets; p
STDIN.noecho{|f|f.gets("!")}; p STDIN.getch'
ruby 1.9.3dev (2010-07-06 trunk 28554) [x86_64-linux]
hello
"hello\n"
"world!"
"\n"
Excellent. I'm glad this was added then.
This appears to not work on windows is that expected?
Roger said:NB if you *do* want arrow keys you'll want to wrap _getch or _getkbhit,
like rb-readline does. See also [1]..
-r
[1] http://betterlogic.com/roger/?p=2930
What does it return when arrow keys are hit?like rb-readline does. See also [1]..
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.