Skip to content

fix: normalize dead-key grave input in composer#3158

Open
StiensWout wants to merge 2 commits into
pingdotgg:mainfrom
StiensWout:fix/dead-key-grave-normalization
Open

fix: normalize dead-key grave input in composer#3158
StiensWout wants to merge 2 commits into
pingdotgg:mainfrom
StiensWout:fix/dead-key-grave-normalization

Conversation

@StiensWout

@StiensWout StiensWout commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Normalize dead-key grave look-alike composition input in the web composer before it reaches stored prompt text.
  • Reuse the existing selected-text backtick surround behavior and insert ASCII backticks for collapsed selections.

Root cause

Some keyboard layouts emit grave-like Unicode characters (ˋ, , ) through insertCompositionText after a dead-key press. The composer accepted those literal characters, so Markdown inline-code delimiters were not recognized.

Impact

Dead-key grave input now produces ASCII backticks only at the input boundary. Pasted text and non-dead-key Unicode content are left unchanged.

Validation

  • vp check
  • vp run typecheck
  • cd apps/web && vp test run --project browser src/components/ChatView.browser.tsx -t "supports dead-key composition"
  • Temporary browser assertion for Dead + U+02CB -> ASCII backtick passed locally and was removed.

Closes #3142

Note

Normalize dead-key grave input to backtick in ComposerSurroundSelectionPlugin

  • Dead-key grave sequences (e.g. on macOS) can produce lookalike characters (U+02CB, U+2035, U+FF40) instead of a backtick, breaking backtick-based surround insertion in the composer.
  • Tracks plain dead-key keydown events via recentDeadKeyDownRef with a 1,000 ms recency window; when a grave-lookalike character arrives via insertCompositionText within that window, it is treated as a backtick.
  • Applies surround insertion if a selection is pending, or inserts a literal backtick otherwise, suppressing the original lookalike character.
  • Adds hasCommandModifier helper to centralize meta/ctrl modifier checks across key event handlers.

Macroscope summarized 8c94e32.


Note

Low Risk
Scoped to composer keyboard/composition handling for a specific dead-key pattern; no auth, persistence, or broad input-path changes.

Overview
Fixes composer markdown inline-code behavior when some layouts emit grave lookalike Unicode (ˋ, , ) via insertCompositionText after a Dead key instead of ASCII `.

ComposerSurroundSelectionPlugin now records a plain Dead keydown (1s window, cleared on most other keys but not plain Space) and, on matching composition input, runs the existing backtick surround path or inserts a literal backtick, then suppresses the lookalike character. Modifier checks use a shared hasCommandModifier helper. Pasted text and unrelated Unicode are unchanged.

Reviewed by Cursor Bugbot for commit 8c94e32. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-authored-by: Codex <codex@openai.com>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 19b08319-2905-4825-aeff-0110a99edb33

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jun 19, 2026
@StiensWout StiensWout marked this pull request as ready for review June 19, 2026 06:00

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3001509. Configure here.

Comment thread apps/web/src/components/ComposerPromptEditor.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Straightforward bug fix that normalizes international keyboard dead-key grave characters to standard backticks in the composer. Changes are self-contained within input handling logic with clear intent and limited scope.

You can customize Macroscope's approvability policy. Learn more.

Co-authored-by: Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Inline code typed on dead-key keyboard layouts renders literally (non-ASCII grave instead of U+0060)

1 participant