ruby / ruby/reline

Readline vi-mode doesn't work as expected

Open
#725 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
311
Forks
99
Avg merge
6d 4h
Merged PRs (30d)
1

Description

Problem overview

The new irb version appears to have problems with vi-mode readline (don't know about emacs-mode).

Not sure what the full extent of these problems is, but noticed a few common normal mode commands not working as expected. These include:

  • A does not jump to the end of the line
  • similarly, I does not jump to the beginning of the line
  • t enters insert mode instead of waiting for a character and then jumping before its first occurence after the cursor. Similarly with T and F (f appears to work correctly)
  • u doesn't undo the last edit
  • c is a no-op instead of waiting for a movement, then changing text between cursor and movement destination

I imagine this problem is more widespread and there are other readline functionalities that don't function as expected. All of these work as expected in irb --legacy and other readline programs (e.g. bash).

Steps to reproduce

(this is all on irb-1.2.1 installed from GitHub)

To reproduce the first issue from above, set readline to vi-mode, e.g. by modifying ~/.inputrc:

set editing-mode vi

Start irb, then enter the following sequence of keystrokes:

123<escape>BA

This results in the buffer containing the following (^ indicates cursor position):

A123
 ^

in normal mode, whereas irb --legacy (or another readline program like bash) would lead to

123
   ^

in insert mode.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the vi-mode cases in irb-1.2.1 with set editing-mode vi in ~/.inputrc, then compare the same keystrokes in irb --legacy or bash. Trace the readline-compatible vi-mode entry points responsible for A, I, t/T/F, u, and c; done means these commands behave as described in the issue without regressing insert mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.