Skip to content

feat(tui): add opt-in Kitty key release events - #43419

Closed
ihxnnxs wants to merge 4 commits into
anomalyco:devfrom
ihxnnxs:kitty-key-events
Closed

ihxnnxs wants to merge 4 commits into
anomalyco:devfrom
ihxnnxs:kitty-key-events

Conversation

@ihxnnxs

@ihxnnxs ihxnnxs commented Aug 19, 2026

Copy link
Copy Markdown

Issue for this PR

Related to #35219. Replaces #41421.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds an opt-in kitty_keyboard.events setting to tui.json.

When enabled, OpenCode requests Kitty press, repeat, and release events through OpenTUI. The setting is forwarded through both TUI renderer paths and remains disabled by default because release handling is unreliable in some terminals.

The existing Windows behavior in direct mode is preserved.

How did you verify your code works?

  • packages/tui: bun test --timeout 30000 test/config.test.tsx - 9 passed
  • packages/opencode: bun test --timeout 30000 test/cli/run/runtime.boot.test.ts - 6 passed
  • packages/tui: bun run typecheck
  • packages/opencode: bun run typecheck
  • git diff --check

Screenshots / recordings

N/A. This changes terminal protocol configuration and has no visual UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Enough1122

Copy link
Copy Markdown

AI code review — automated review for reference; please use your judgment.

  • packages/opencode/src/cli/cmd/run/runtime.lifecycle.ts:189 — input.tuiConfig.kitty_keyboard.events is dereferenced without a guard while kitty_keyboard is optional in the schema and RunTuiConfig is assembled inside runTuiConfig() from a Config | undefined value — if any caller passes an unresolved/raw config this throws and kills CLI startup before the TUI ever renders. Use input.tuiConfig.kitty_keyboard?.events ?? false.
  • packages/tui/src/app.tsx:199 — same pattern: input.config.kitty_keyboard.events will throw when input.config did not go through resolve() (e.g. embedded/direct-config paths). Prefer input.config.kitty_keyboard?.events ?? false for symmetry with the other optional settings handled here.
  • packages/opencode/src/cli/cmd/run/runtime.lifecycle.ts:189 — the process.platform === "win32" || short-circuit means an explicit kitty_keyboard: { events: false } can never disable events on Windows, which contradicts the new docs warning that some terminals report release events incorrectly. Either let an explicit false win (e.g. events: cfg || (process.platform === "win32" && cfg !== false)) or document that Windows is force-enabled regardless of the setting.
  • packages/tui/test/config.test.tsx — resolve() defaults and overrides are well covered, but the new wiring has zero coverage: nothing pins that runTuiConfig() forwards kitty_keyboard nor the win32-OR precedence. Add a small unit test for both branches to prevent regressions.
  • packages/web/src/content/docs/config.mdx:294 and packages/web/src/content/docs/tui.mdx:404 — the identical caution sentence now exists in four places (schema annotation plus two docs files, twice each); the copies will drift apart over time. Keep one canonical paragraph and cross-link the rest. (nit)

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants