If I do a reverse interactive search in irb and then enter a control character (arrow keys are the only ones I've seen this with actually). So I start with this session:
$ irb
>> print "hello"
hello
then enter ^r
, h
$ irb
>> print "hello"
hello
(reverse-i-search)`he': print "hello"
So far so good. Then I hit the left arrow, and I end up with this:
$ irb
>> print "hello"
hello
>> print "[Dhello"
Subsequent use of the arrows moves the cursor around normally.
Do you have vi editing mode enabled?
I had it turned on in my
$HOME/.inputrc
file viaset editing-mode vi
. Disabling it "fixed" my arrow-keys.As mentioned by @JoLiss, other readline programs (bash, etc.) were also working correctly; so AFAICT, it's a Ruby problem. See: http://bugs.ruby-lang.org/issues/7859#change-36333