Closed luqmanishere closed 7 months ago
Thank you for writing this, I hadn't caught this as I write on mac.
This is great, however, we need to also check for repeat, as that can be emitted as well.
If you fix this, I can pull it in and release a tag!
Thanks for the reply. As I understand it, repeated key inputs (by holding it down) should work just fine since on Unix systems, it would just be repeated key presses. The Repeat
and Release
kinds on Unix is only used when the special flag is enabled via:
execute!(
stdout,
PushKeyboardEnhancementFlags(KeyboardEnhancementFlags::REPORT_EVENT_TYPES)
);
And only a select few terminals support this flag, notably kitty
being the source of this protocol. Repeat (held down) inputs should be shown as KeyEventKind::Press
over multiple queries to crossterm's event::read()
On Windows holding down the key works as expected (repeated KeyEventKind::Press
), which can be tested with the custom_set
example or any of crossterm's event reading examples.
Please advise me if there are any other changes needed.
Yep, wasn't sure how it worked on windows, in that case, thank you! I'll pull that in as soon as I get a chance to look at it closer.
Implemented in version 0.5.1
crossterm
emits events upon keyboard press and release, which causes duplicate events for the same key onWindows
.This PR adds checks for only a key
press
so only 1 event is returned on Windows.I've yet to test this change on Linux, however it should not break as
KeyEventKind
is not read on Linux (bar special flags) and defaults toPress
anyways.