-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Truffle] Implement readline #3917
Conversation
…a primitive. The primitive system is a bit too fickle for this use case.
I'm really not sure how well this will work cross-contexts, but perhaps if readline is being source by something other than STDIN this will be valuable. It's cleaner in any event.
The full form of this method takes an offset and length, but it's not clear that JLine supports this.
Note that we don't currently support this in JRuby+Truffle, but I've retained the structure to make porting easier in the future.
public DynamicObject each(VirtualFrame frame, DynamicObject history, DynamicObject block) { | ||
final ConsoleHolder consoleHolder = getContext().getConsoleHolder(); | ||
|
||
for (Iterator<History.Entry> i = consoleHolder.getHistory().iterator(); i.hasNext();) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be a for-each loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. I meant to, but forgot as I transposed.
} | ||
|
||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
LGTM, only minor: could you split some of the long lines. |
@jruby/truffle
This isn't 100% on par with what JRuby has, but it's pretty close. It fixes the biggest usability problem I've had with IRB in JRuby+Truffle: the arrow keys don't work. Now you can scroll through history and move between characters on the same line.