Interactive shell line editing broken with recent JLine

RESOLVED FIXED

Status

Rhino
Core
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Kevin Locke, Unassigned)

Tracking

Details

(Reporter)

Description

6 years ago
When using JLine in the interactive shell, the first left-movement action (either backspace or left arrow) results in moving left 4 characters before completing the action (so deleting a character using backspace results in the last 5 characters on the line being removed, including prompt characters - moving left results in moving the cursor left 5 characters).  This occurs in every terminal that I have tested in Linux.

After investigating further, it appears that this behavior was introduced by https://github.com/jline/jline/commit/de5f3664425cbfeb683e7b0c8abd40f475444cbc and the behavior appears in all subsequent commits that I tested.  It appears to be a result of how the prompt is printed and that JLine doesn't realize additional characters have been printed; if I set the prompts to "" the problem disappears.

One solution is to use jline.ConsoleReader.readLine(String) to print the prompt and read user input (with an appropriate bridge to System.in/out in the case JLine is not available).  Another might be to see if the JLine devs could provide a fix for the old behavior (since it looks like Bean Shell is broken in the same way).
Pull request at https://github.com/mozilla/rhino/pull/63

Comment 2

6 years ago
Merged into git master:

https://github.com/mozilla/rhino/commit/e848e29d3827813d9ab08fc207585fa14a06035c
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.