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

Conditional Bind Sequences #269

Open
madprops opened this issue Aug 19, 2019 · 5 comments
Open

Conditional Bind Sequences #269

madprops opened this issue Aug 19, 2019 · 5 comments

Comments

@madprops
Copy link

madprops commented Aug 19, 2019

I use editor.bind_sequence(KeyPress::Esc, Cmd::Interrupt);
Which works. I'm wondering if it could be possible to make it clear text if there's some written text, and if not then Interrupt..

@madprops madprops changed the title Conditional Escape Conditional Bind Sequences Aug 19, 2019
@gwenn
Copy link
Collaborator

gwenn commented Aug 19, 2019

Sorry, you can't do this with rustyline.
linefeed can.
We need something like a Cmd::Custom(fn(&mut LineBuffer) -> Action).

enum Action {
  Continue,
  Return,
  Bail,
}

like replxx

@lythesia
Copy link

lythesia commented Sep 9, 2019

Same problems here(to bind CompleteHint or ForwardChar to Ctrl-F whether current input pos is at eol), hope this features can be implemented in rustyline :(

@gwenn
Copy link
Collaborator

gwenn commented Oct 20, 2019

Could you please give a try to PR #293 ?
I will try to provide an example.
And I guess we still need a composite Cmd to clear text and then interrupt.

@adam-mcdaniel
Copy link

This would be really helpful for my terminal app. Id like to be able to use keybindings that depend on the text already entered.

@gwenn
Copy link
Collaborator

gwenn commented Mar 7, 2021

Partially fixed in version 8.0.0
But still no multiple actions

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

Successfully merging a pull request may close this issue.

4 participants