Closed Bug 774083 Opened 12 years ago Closed 12 years ago

Interactive shell line editing broken with recent JLine

Categories

(Rhino Graveyard :: Core, defect)

head
x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: kevin, Unassigned)

Details

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).
Merged into git master:

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