Skip to content

Fix 'double event' on windows crossterm read#27

Merged
Lutetium-Vanadium merged 1 commit intoLutetium-Vanadium:masterfrom
barafael:master
Dec 2, 2025
Merged

Fix 'double event' on windows crossterm read#27
Lutetium-Vanadium merged 1 commit intoLutetium-Vanadium:masterfrom
barafael:master

Conversation

@barafael
Copy link

Fixes #26. Can be observed via cargo run --example input on windows.

@Lutetium-Vanadium
Copy link
Owner

Hi, thanks for the PR! The change overall looks good, but I have a few questions regarding it that I can't test since I don't have a windows system.

  1. What is the KeyEventKind for the starting newline character?
  2. Does this change work with holding down a key? Reading the documentation it seems like a repeat event should be released for this case, but it may differ for windows.

@barafael
Copy link
Author

barafael commented Dec 1, 2025

  1. The initial "newline" character looks like it is the release event of the enter keypress that started the program. If I hold Enter (not releasing it), I get repeated "Press" -> "Release" events, but no "Repeat" events.
  2. This is true for other keys as well - i never seem to get a repeat event from crossterm. I'm using the crossterm event-read example for testing this. Note I'm not getting repeat events on linux either. On Linux, I didn't see any repeat or release events.

@Lutetium-Vanadium
Copy link
Owner

Ok, since the newline is a release event can we add the repeat event to the conditon. This is closest to the original code while fixing the bug, and there may be some combination of terminal emulator and operating system that returns repeat.

@barafael
Copy link
Author

barafael commented Dec 2, 2025

it is done

@Lutetium-Vanadium Lutetium-Vanadium merged commit c3077b8 into Lutetium-Vanadium:master Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Seems broken on windows

2 participants