Skip to content

fix: handle capital keybindings from enhanced keyboard events - #322

Merged
bjarneo merged 1 commit into
bjarneo:mainfrom
mvanhorn:fix/286-capital-keybindings
Aug 20, 2026
Merged

fix: handle capital keybindings from enhanced keyboard events#322
bjarneo merged 1 commit into
bjarneo:mainfrom
mvanhorn:fix/286-capital-keybindings

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Normalize enhanced printable Shift+letter events at the start of Model.handleKey, before global checks or delegation to overlay handlers, so every existing msg.String() switch receives the same uppercase textual representation used by non-enhanced terminals. Use Bubble Tea's structured key fields to recognize an ASCII letter with an uppercase ShiftedCode and no usable text, and preserve the original event for lowercase input, non-letter shifted keys, and combinations carrying Ctrl, Alt, or other non-Shift modifiers. Keep the existing shortcut switches and provider mapping unchanged; the normalization belongs at the shared production dispatch boundary rather than in each individual handler.

Capital-letter shortcuts such as Y and N do not fire for the reporter in MacTerm 1.20.9 with TERM=xterm-ghostty, although lowercase shortcuts and shifted shortcuts in another TUI work normally. The thread identifies the concrete mismatch: Bubble Tea's enhanced keyboard reporting can stringify a shifted letter as shift+y, while cliamp's dispatch switches match literal uppercase strings such as Y. Because handleKey forwards the original key message into overlay-specific handlers, the same representation mismatch can affect capital shortcuts in both the main player and nested browsers. The issue is open, unassigned, and has no referenced prior or competing pull request.

Fixes #286

Screenshots / video

No user-visible surface changes in this PR, so there is nothing to show.

How to test

Checklist

  • make check passes
  • docs/ and site/index.html updated for user-facing changes

Summary by CodeRabbit

  • Bug Fixes
    • Improved Shift+letter keyboard handling throughout the interface.
    • Shift+Y and Shift+N now correctly support provider selection and browsing.
    • Shifted letters are properly delivered to active text fields.
    • Preserved expected lowercase and uppercase key behavior.
    • Normalized unrelated modified-key input for more consistent handling.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 912bb29d-bc02-4ae2-80e0-62232befec29

📥 Commits

Reviewing files that changed from the base of the PR and between 0c9c30d and 31f4486.

📒 Files selected for processing (2)
  • ui/model/interaction_test.go
  • ui/model/keys.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Shifted letter key handling

Layer / File(s) Summary
Normalize shifted letters before dispatch
ui/model/keys.go
Adds normalizeShiftedLetter and applies it before key dispatch so shifted letters match uppercase key bindings.
Validate key interactions
ui/model/interaction_test.go
Adds provider setup and tests for provider selection, browsing, text input, lowercase behavior, and modified keys.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 31f44

This PR normalizes enhanced Shift+letter keyboard events so existing uppercase shortcuts work consistently in the main interface and nested browsers; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: bjarneo, zambetti

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the fix for capital-letter keybindings from enhanced keyboard events.
Linked Issues check ✅ Passed The changes normalize shifted letters, preserve other key behavior, and add tests for the capital keybinding issue in #286.
Out of Scope Changes check ✅ Passed The changes are limited to key normalization and interaction tests required to fix capital-letter keybindings.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@bjarneo
bjarneo merged commit e0328d9 into bjarneo:main Aug 20, 2026
1 check passed
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.

Capital keybinding doesn't work

2 participants