rustyline icon indicating copy to clipboard operation
rustyline copied to clipboard

Conditional Bind Sequences

Open madprops opened this issue 5 years ago • 5 comments

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 avatar Aug 19 '19 11:08 madprops

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

gwenn avatar Aug 19 '19 16:08 gwenn

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 :(

lythesia avatar Sep 09 '19 09:09 lythesia

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.

gwenn avatar Oct 20 '19 10:10 gwenn

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

adam-mcdaniel avatar Dec 08 '19 20:12 adam-mcdaniel

Partially fixed in version 8.0.0 But still no multiple actions

gwenn avatar Mar 07 '21 08:03 gwenn