While using gets
to accept user input, pressing the arrow keys outputs text to the screen, presumably the character codes. How can I prevent this from happening, and further how can I get the arrow keys to properly move the cursor around?
irb(main):001:0> foo = gets
^[[A^[[D^[[B^[[C
=> "\e[A\e[D\e[B\e[C\n"
Edit: maybe I should mention I'm using Mac OS X and Terminal.app.