kkawakam / rustyline

Readline Implementation in Rust
https://crates.io/crates/rustyline/
MIT License
1.53k stars 176 forks source link

Being able to bind Shift+Enter to something else #653

Closed ghigt closed 1 year ago

ghigt commented 1 year ago

While this works in the example folder:

rl.bind_sequence(
    KeyEvent(KeyCode::Char('s'), Modifiers::CTRL),
    EventHandler::Simple(Cmd::Newline),
);

This is handled by the default Enter behavior:

rl.bind_sequence(
    KeyEvent(KeyCode::Enter, Modifiers::SHIFT),
    EventHandler::Simple(Cmd::Newline),
);

Is it expected or is it a bug?

gwenn commented 1 year ago

On Windows, it may be possible. But on Unix, by default, there is no way to make the distinction between SHIFT-Enter / CTRL-Enter and Enter. See https://unix.stackexchange.com/questions/536352/ctrl-enter-shift-enter-and-enter-are-interpreted-as-the-same-key

patrik-simunic-cz commented 1 week ago

Well..... how does the Node REPL handle this then? Since it's working in there, there obviously has to be a way to distinguish between Enter and SHIFT+Enter(?)

gwenn commented 1 week ago

https://github.com/kkawakam/rustyline/issues/744