Skip to content

fix(web): Cmd+K and Ctrl+L clear the terminal on non-Latin keyboard layouts - #44082

Closed
AymanKhan9 wants to merge 1 commit into
pingdotgg:mainfrom
AymanKhan9:fix/terminal-clear-non-latin-layout
Closed

AymanKhan9 wants to merge 1 commit into
pingdotgg:mainfrom
AymanKhan9:fix/terminal-clear-non-latin-layout

Conversation

@AymanKhan9

Copy link
Copy Markdown
Contributor

On a non-Latin keyboard layout (Russian, Greek, Hebrew, …), Ctrl+L and Cmd+K never cleared the terminal. The shortcut check compared event.key against "l"/"k", but on those layouts event.key is the layout's own letter (e.g. д / л), so the check always failed. Every other shortcut already handles this through resolveEventKeys, which falls back to the physical key.

isTerminalClearShortcut now uses resolveEventKeys like the rest of the keybinding matcher. Added tests for Ctrl+L and Cmd+K on a Russian layout; they fail on main and pass with the fix.

Surfaces: web and desktop share this terminal code. Mobile has no terminal clear shortcut.

Model: Claude Opus 5.5, via Claude Code in T3 Code.

🤖 Generated with Claude Code

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The terminal-clear shortcut now checks normalized event keys for the configured letters. The Ctrl+L and macOS-only Meta+K modifier requirements remain unchanged. Tests cover matching non-Latin event keys on macOS and Linux.

Changes: Terminal clear shortcut

Layer / File(s) Summary
Normalized key matching
apps/web/src/keybindings.ts, apps/web/src/keybindings.test.ts
isTerminalClearShortcut checks keys returned by resolveEventKeys for l or k. Tests cover non-Latin event keys on macOS and Linux, and verify that a different Latin event key does not match by physical position.

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

Change: Bug fix

Suggested reviewers: saphid, prnvbn, nateec

Merge Risk: Minimal · up to 42673

Ctrl+L and Cmd+K terminal clear now work on non-Latin keyboard layouts through the physical key. The change is small and reversible, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and the affected behavior: Cmd+K and Ctrl+L clearing the terminal on non-Latin keyboard layouts. The raw summary shows isTerminalClearShortcut now uses resolveEventKeys, which …
Description check Passed The description follows the template. It gives the problem (Ctrl+L and Cmd+K never cleared the terminal on non-Latin layouts) and the change (isTerminalClearShortcut now uses resolveEventKeys). It lis…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix and the affected behavior: Cmd+K and Ctrl+L clearing the terminal on non-Latin keyboard layouts. The raw summary shows isTerminalClearShortcut now uses resolveEventKeys, which matches this title. The title follows the conventional commit form used by the repository template.

Full details: Description check

Explanation

The description follows the template. It gives the problem (Ctrl+L and Cmd+K never cleared the terminal on non-Latin layouts) and the change (isTerminalClearShortcut now uses resolveEventKeys). It lists added tests for a Russian layout and states they fail on main and pass with the fix, which covers verification. Scope is a bug fix, but the description does not link an issue or explain why none is needed, and it does not state a reason for the change beyond the bug itself. The template asks for an issue link or a reason for omitting one, so this section is incomplete. The other sections are filled in, so the description is mostly complete.

Resolution

Consider adding a link to the issue that shows the bug, or a short reason why a small fix needs no issue. The description otherwise meets the template.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3fcfcae and 4267312.

Files selected for processing: 2

  • apps/web/src/keybindings.test.ts
  • apps/web/src/keybindings.ts

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

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for this. Before a bug fix is taken further, the bug is reproduced on current main, and here it did not appear.

We ran this on main at 3fcfcae with the Russian layout active and used real OS keystrokes, not synthetic events. On Linux we used the web app in Chrome; on macOS we used the desktop app. Each time we filled the terminal with output and pressed the shortcut. Ctrl with the physical L key (which types д) cleared the terminal on both platforms. Cmd with the physical K key on macOS cleared it too.

You're right that the clear-shortcut check compares event.key, and that on Linux it sees "д" and returns false. The event then goes to the terminal's key encoder, though, and that encoder works from the physical key code, so the shell still gets ^L. On macOS, Command shortcuts report the Latin letter even under the Russian layout: the page sees key "k", so the existing check already matches.

We couldn't find a case where the shortcut fails for a user. If you've seen it fail on a specific layout, OS or browser, please tell us which and we'll take another look.

Closing this pull request. If it still happens for you, please open an issue with the exact steps, what you see, and the version and platform you are on; a fix is picked up from there.

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

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants