Skip to content

[codex] Fix Windows TUI key handling - #8

Merged
adambuchweitz merged 3 commits into
mainfrom
codex/fix-windows-tui-key-release
Apr 14, 2026
Merged

[codex] Fix Windows TUI key handling#8
adambuchweitz merged 3 commits into
mainfrom
codex/fix-windows-tui-key-release

Conversation

@adambuchweitz

@adambuchweitz adambuchweitz commented Apr 13, 2026

Copy link
Copy Markdown
Owner

Summary

This fixes duplicated key handling in the TUI Manager on Windows.

What changed

  • ignore crossterm KeyEventKind::Release events before dispatching Manager input
  • add regression tests covering filter typing, editor typing, and Tab field navigation

Why

On Windows, crossterm reports key release events, and the Manager was treating them the same as actual key presses. That caused characters to be inserted twice and Tab to advance twice.

Validation

  • cargo test
  • commit hook formatting check
  • commit hook clippy check

Summary by CodeRabbit

  • Bug Fixes

    • Keyboard release events are now ignored across all modes, preventing unintended state changes and duplicate actions.
  • New Features

    • Added CLI version flag (-v/--version) to print the application version.
  • Tests

    • Added tests verifying release events are ignored and that the version flag prints the correct version.
  • Chores

    • Application version bumped to 0.1.5.

@coderabbitai

coderabbitai Bot commented Apr 13, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 499014b8-64d7-4fca-b75f-96e9908c66b4

📥 Commits

Reviewing files that changed from the base of the PR and between 5a98cfa and c95060e.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • src/cli.rs
  • src/tui/events.rs
  • tests/cli.rs
✅ Files skipped from review due to trivial changes (2)
  • Cargo.toml
  • tests/cli.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/cli.rs
  • src/tui/events.rs

📝 Walkthrough

Walkthrough

Short-circuits keyboard release events in the TUI: handle_key now returns EventResult::None on KeyEventKind::Release without invoking mode-specific handlers. Adds unit tests for release-event behavior. Also updates CLI to expose a version flag and corresponding tests; bumps crate version in Cargo.toml.

Changes

Cohort / File(s) Summary
TUI event handling & tests
src/tui/events.rs
Early-return on KeyEventKind::Release in handle_key; import KeyEventKind; added unit tests ensuring release events don't change filter state, editor content, or Tab navigation.
CLI definition & tests
src/cli.rs, tests/cli.rs
Added version_flag to Cli using ArgAction::Version; extended help expectations; added test helper to run the binary and tests asserting -v/--version output equals crate version.
Package metadata
Cargo.toml
Bumped crate version from 0.1.4 to 0.1.5.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title refers to fixing Windows TUI key handling, but the main changes involve ignoring KeyEventKind::Release events (applicable to all platforms), adding version flag support in CLI, and updating version numbers. The title is partially related but does not reflect the full scope of changes. Consider a more comprehensive title that captures both the key release event fix and the version flag addition, such as 'Add version flag support and fix key release event handling' or clarify if the PR scope is narrower than presented.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-windows-tui-key-release

Comment @coderabbitai help to get the list of available commands and usage tips.

@adambuchweitz
adambuchweitz force-pushed the codex/fix-windows-tui-key-release branch 2 times, most recently from 7b5985b to b2e8a1b Compare April 13, 2026 21:09
@adambuchweitz
adambuchweitz marked this pull request as ready for review April 14, 2026 14:32
@adambuchweitz
adambuchweitz force-pushed the codex/fix-windows-tui-key-release branch from 5a98cfa to c95060e Compare April 14, 2026 16:18
@adambuchweitz
adambuchweitz merged commit 66d9211 into main Apr 14, 2026
5 checks passed
@adambuchweitz
adambuchweitz deleted the codex/fix-windows-tui-key-release branch April 14, 2026 16:21
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