Alexander Presber
Alexander Presber

Reputation: 6635

Cursor keys leave insert mode in irb in vi mode

I am using vi-mode in irb by having a ~/.inputrc stating:

set editing-mode vi

Since I changed to ruby 1.9.3 and 2.0.0, IRB and the rails console started behaving differently.

Before I could use the left and right cursor arrow keys in insert mode and the cursor would move accordingly, staying in insert mode (like standard in vim).

Typing arrow left now deletes all characters till the end of the line and takes me right out of insert mode. I am lost, why is this happening?

UPDATE: How can I get irb to interpret the arrow keys as such and not as escape sequences?

Upvotes: 1

Views: 572

Answers (1)

Max
Max

Reputation: 22365

This is because Readline is interpreting the escape characters for the cursor keys. Left cursor is ESC[D which leaves insert mode and then deletes the rest of the line. Similarly cursor right will leave insert mode and Change the rest of the line, up will Append to the rest of the line and down will go Back a word.

I believe this could be the same thing as bug #7859.

Upvotes: 0

Related Questions