T
thefed
Hey all,
In short, I'm looking to, through an STDIN/OUT console interface,
detect which arrows keys have been pressed. Here is everything I have
so far...
PRGM A = http://pastie.caboo.se/133393
using PRGM A, I have been able to detect all key combinations
necessary for all of my motives - except, of course, for this one.
Let's go through a basic run-through:
$ ruby single_character.rb
Enter one character: 27 # UP-arrow
$ ruby single_character.rb
Enter one character: 27 # DOWN-arrow
$ ruby single_character.rb
Enter one character: 27 # LEFT-arrow
$ ruby single_character.rb
Enter one character: 27 # RIGHT-arrow
Hmm... Something's not right here... Why are they all the same?
So that is as far as I have been able to get. OH! My goal:
Write a pure ruby Readline alternative.
--> (Actually, just emulate history)
Yes, I understand there is a Readline for windows, but really,
detecting this is harder for the programmer, and thus less work for
the user. Probably me.
Is there some hidden method that I am not realizing?
Thanks,
Ari
--------------------------------------------|
If you're not living on the edge,
then you're just wasting space.
In short, I'm looking to, through an STDIN/OUT console interface,
detect which arrows keys have been pressed. Here is everything I have
so far...
PRGM A = http://pastie.caboo.se/133393
using PRGM A, I have been able to detect all key combinations
necessary for all of my motives - except, of course, for this one.
Let's go through a basic run-through:
$ ruby single_character.rb
Enter one character: 27 # UP-arrow
$ ruby single_character.rb
Enter one character: 27 # DOWN-arrow
$ ruby single_character.rb
Enter one character: 27 # LEFT-arrow
$ ruby single_character.rb
Enter one character: 27 # RIGHT-arrow
Hmm... Something's not right here... Why are they all the same?
So that is as far as I have been able to get. OH! My goal:
Write a pure ruby Readline alternative.
--> (Actually, just emulate history)
Yes, I understand there is a Readline for windows, but really,
detecting this is harder for the programmer, and thus less work for
the user. Probably me.
Is there some hidden method that I am not realizing?
Thanks,
Ari
--------------------------------------------|
If you're not living on the edge,
then you're just wasting space.