Skip to content

Fix/windows key release input#5

Open
1553620375 wants to merge 1 commit into
a3s-cli-v0.5.12from
fix/windows-key-release-input
Open

Fix/windows key release input#5
1553620375 wants to merge 1 commit into
a3s-cli-v0.5.12from
fix/windows-key-release-input

Conversation

@1553620375

Copy link
Copy Markdown

Summary

Fix duplicate TUI input on Windows by filtering key release events at the terminal event
boundary.

On Windows, crossterm reports key press and key release as separate keyboard events. The TUI
adapter previously dropped KeyEventKind, so both press and release were converted into the
same internal key event. This caused typed characters to appear twice, and Backspace/Delete
to delete twice.

This change adds a centralized crossterm-to-TUI conversion path that ignores
KeyEventKind::Release before events reach UI models. Press and Repeat events are still
preserved, so normal input and held-key repeat behavior continue to work.

Changes

  • Add Event::from_crossterm(...) -> Option<Event> for crossterm event conversion.
  • Filter out KeyEventKind::Release at the event boundary.
  • Update both Program and ElementProgram event loops to use the filtered conversion path.
  • Add regression tests for release filtering and press/repeat preservation.

Verification

Ran from TUI:

cargo fmt --all -- --check
cargo test --all-targets
cargo clippy --all-targets -- -D warnings

Ran from Cli:

cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test --all-targets

Note: one Cli full-suite run had a transient failure in
update::tests::standalone_upgrade_fallback_downloads_installs_and_verifies. That test
exercises standalone updater replacement and is unrelated to terminal input. It passed when
rerun directly.

## Risk

Low. The change is isolated to the crossterm-to-TUI event boundary and does not directly
change textarea, editor, menu, or keymap behavior. Press and repeat events are still
delivered unchanged.

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.

1 participant