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

Key events are reported incorrectly #663

Open
ClementNerma opened this issue Nov 11, 2023 · 1 comment
Open

Key events are reported incorrectly #663

ClementNerma opened this issue Nov 11, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ClementNerma
Copy link
Contributor

Environment: Windows 11 -> Windows Terminal -> WSL or PowerShell

When imlpement my own EditMode, I stumbled upon an issue: some key events are reported incorrectly.

Basically, I convert the event using ReedlineRawEvent::into() which gives me a crossterm::event::Event value.

If I press Ctrl + Backspace for instance, it will be reported as the w key pressed with the CONTROL modifier.

I tried to debug a little bit by modifying reedline's code and it seems like the event reedline gets from crossterm using crossterm::event::read() already contains the error, it is not caused by a faulty event conversion.

When running the event_listener example in this crate with cargo run --example event_listener, I get the correct code reported.

I tried putting a terminal::enable_raw_mode() just before the event reading, but it did not work. Maybe it needs to be set as soon as the program begins? But would that cause other troubles? I don't enough about terminals to answer this.

But this is a big problem as it makes handling some key combinations impossible. Also pressing Ctrl + Backspace and Ctrl +w return the exact same event, so it's not even possible to work around this problem using a little "hack" hashmap mapping the correct codes.

@ClementNerma
Copy link
Contributor Author

I just found out it seems related to this still open crossterm issue: crossterm-rs/crossterm#685

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant