From: Marc Heiler Date: 2011-05-22T23:27:26+09:00 Subject: User input - get keystrokes (arrow keys + shift) Hello. I am trying to find out how to do a specific action / call a method if a user presses the SHIFT key and an arrow key. (Two keys pressed together) I use this for a very simple program, a pseudo shell. Like, "cd /home/marcelle" allows the user to enter the /home/marcelle directory via Dir.chdir. Now, if SHIFT + left arrow key is pressed, I want to be able to go back one directory, i.e. to "/home". (To simplify, the SHIFT key could be omitted and just the arrow key used) My problem is that I do not know how I can intercept or even act on this at all. It seems so far that mostly, via $stdin.gets, you must wait for ENTER to be pressed. Logically, if a user presses shift + left arrow key, there won't be any enter here as part of the input. How can I get the information that the arrow key was pressed? Is there a way in Ruby to do a specific action when: - any single key is input - any combination is input (i.e. shift + another character) -- Posted via http://www.ruby-forum.com/.