Skip to content

fix(tui): uppercase Shift + any lowercase letter, not only ASCII - #588

Merged
LargeModGames merged 1 commit into
LargeModGames:mainfrom
kapok-4o:fix/shift-non-ascii-uppercase
Sep 26, 2026
Merged

LargeModGames merged 1 commit into
LargeModGames:mainfrom
kapok-4o:fix/shift-non-ascii-uppercase

Conversation

@kapok-4o

@kapok-4o kapok-4o commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #553. The SHIFT arm of impl From<event::KeyEvent> for Key only uppercased ASCII letters. It now uppercases any lowercase letter whose uppercase is a single char, so Shift+ö gives Ö and Shift+é gives É. ß (uppercase SS) stays ß.

Adds the first tests for key.rs, with the cases from the issue:

  • ö + SHIFT gives Ö, é + SHIFT gives É
  • ß + SHIFT stays ß
  • p + SHIFT still gives P
  • Ö + SHIFT stays Ö

test_attribute_total goes from 2291 to 2295. Rebased on top of #587, which touched the same two lines in tools/gates.count and the [Unreleased] changelog.

Testing

  • cargo fmt --all -- --check: clean
  • cargo clippy --no-default-features --features telemetry,tui -- -D warnings: clean
  • cargo test --no-default-features --features telemetry,tui: 1266 passed, 0 failed (after the rebase)
  • cargo test --no-default-features --features telemetry,tui shift_with_a_lowercase: 1 passed
  • With the old ASCII-only guard put back, shift_with_a_lowercase_non_ascii_letter_gives_its_uppercase_char fails and the other three pass.

Additional notes

I tried to reproduce this on a real terminal: Ghostty 1.3.1 on macOS, with the same keyboard enhancement flags spotatui pushes (the probe reported the protocol as on). With a US (ABC) layout, in the English input mode:

  • Shift+P arrives as Char('P') with SHIFT, not Char('p') with SHIFT
  • Option-composed É arrives as Char('É') with no modifier
  • Option acts as Alt under the protocol, so Option+s arrives as s with ALT rather than ß

So I couldn't hit the lowercase-plus-SHIFT case on Ghostty with a US layout. It may still show up on other terminals (#141) or on layouts with a physical ö key, which I don't have. The fix doesn't change anything for the events above.

I wrote this with an AI coding assistant and reviewed the change myself.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: LargeModGames/spotatui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: b15639b4-a885-44cd-9e78-ba90e4060a76

📥 Commits

Reviewing files that changed from the base of the PR and between 37535eb and 74e63f5.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • tools/gates.count
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Shift-modified lowercase characters now convert to uppercase when the uppercase mapping contains exactly one character. Tests cover ASCII and non-ASCII letters, multi-character uppercase mappings, and already-uppercase input.

Changes

Shift key conversion

Layer / File(s) Summary
Normalize Shift-modified characters
src/tui/event/key.rs, CHANGELOG.md, tools/gates.count
The Shift-character conversion handles lowercase Unicode characters and preserves the original character when uppercase requires multiple characters. Tests cover ASCII and Unicode cases. The changelog records the fix, and the test-attribute baseline increases from 2291 to 2295.

Priority: ⬇️ Low

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

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 74e63

Shift-modified lowercase Unicode letters can use their single-character uppercase bindings, while multi-character mappings remain unchanged. No actionable merge risk remains beyond normal checks.

Architecture Summary

Architecture risk: 🔵 Low · up to 74e63

The change affects 3 systems.

Changed systems: CHANGELOG.md, src, tools

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — CHANGELOG.md (service) was modified; 1 changed file maps to changed impact.
  • observed — src (service) was modified; 1 changed file maps to changed impact.
  • observed — tools (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in src/tui/event/key.rs: The Shift-character branch now applies to all lowercase characters instead of only ASCII lowercase characters. It uses single_char_uppercase and preserves the original character when uppercase expands to multiple characters.
  • observed — Modified behavior in src/tui/event/key.rs: Added single_char_uppercase, which returns the uppercase character only when the uppercase mapping contains exactly one character; otherwise it returns None.
  • observed — Modified behavior in src/tui/event/key.rs: Added tests for shifted lowercase non-ASCII and ASCII characters, lowercase ß whose uppercase mapping has multiple characters, and an already-uppercase character.
  • observed — Modified behavior in CHANGELOG.md: Added an Unreleased Fixed entry describing uppercase keybinding handling for shifted lowercase non-ASCII letters, with multi-letter uppercase mappings such as ß left unchanged; references issue #553.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change satisfies issue #553. src/tui/event/key.rs converts Shift-modified lowercase Unicode characters to uppercase only when the uppercase mapping has one character. This preserves ß. Tests c…
Out of Scope Changes check ✅ Passed The changes stay within issue #553. The tests verify the requested behavior. The tools/gates.count update supports the added tests. The [Unreleased] changelog entry documents the fix. No unrelated…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the allowed scoped conventional-commit prefix fix(tui): and clearly describes the Unicode lowercase Shift conversion change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
✨ Simplify code
  • Create a new PR

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.

@codecov

codecov Bot commented Sep 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

The SHIFT arm of the crossterm key conversion only uppercased ASCII
letters, so on terminals that send Shift+ö as `ö` with SHIFT held, an
`Ö` binding never fired. Uppercase any lowercase letter whose uppercase
is a single char, keep `ß` (uppercase `SS`) as is, and add the first
tests for key.rs.

Fixes LargeModGames#553

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@LargeModGames
LargeModGames force-pushed the fix/shift-non-ascii-uppercase branch from 37535eb to 74e63f5 Compare September 26, 2026 18:53
@LargeModGames
LargeModGames merged commit 065790c into LargeModGames:main Sep 26, 2026
31 checks 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.

Shift + a non-ASCII letter does not trigger its uppercase binding (Ö, É)

2 participants