Skip to content
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

Feature request: retain previous line #72

Open
cizra opened this issue May 10, 2017 · 1 comment
Open

Feature request: retain previous line #72

cizra opened this issue May 10, 2017 · 1 comment

Comments

@cizra
Copy link

cizra commented May 10, 2017

Hello!

I'd like rlwrap to have an option --retain to retain the last typed command. It should work like prompt, except it should be editable by the user.

Inputting a command and then pressing enter again n times would cause the same command to be sent n+1 times in total.

Ideally, starting typing would erase whatever's in the previous input buf without needing any backspacing / ctrl-u.

@hanslub42
Copy link
Owner

hanslub42 commented May 12, 2017

Thanks for the nice idea! (and the patches) But why stop at just repeating the previous input? What I would like to make possible is to guess it: If I enter one, two and three rlwrap should suggest four (and not just repeat three). Or, less far-fetched: only repeat the previous input if it ends with a space, or if the previous two input lines were identical.

This is the kind of flexibility that is made possible by filters. Currently, rlwrap doesn't allow a filter to suggest the next input, but $filter->handle_input() could be made to return two values: the re-written input line, and a suggestion for the next input line. There already are more filter types that return multiple values (like the hotkey and completion filters), so the machinery for that is in place.

We could even add a Boolean erase_on_keypress return value that determines whether the suggested input should disappear when a non-arrow key is hit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants