Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): prevent duplicate quotes from dead keys #12644

ClosedSpizzyCoder(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/12644/headopened View on GitHub

What Changed

Restrict the composer's selection-wrapping behavior to actual text selections and skip it during composition.

Why

With a US International keyboard layout, typing a quote dead key followed by Space duplicates the quote. The composer treated the composition replacement range as selected text and applied quote wrapping.

The guard lets native composition finish while preserving quote wrapping for explicitly selected text.

UI Changes

None

Validation

  • Quote key + Space inserts one apostrophe.
  • Double-quote key + Space inserts one double quote.
  • Quote key + vowel still produces the expected accented character.
  • Selecting a word and typing a quote using Right Alt + Shift still wraps it.
  • 111 related tests passed.
  • Web typecheck, targeted lint, and formatting checks passed.

Checklist

  • This PR is small and focused
  • I explained what changed and why

Summary by CodeRabbit

  • Bug Fixes
    • Improved text editing behavior during composition and dead-key input.
    • Prevented surrounding markers from being applied prematurely while native text input is still in progress.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at ad62c77

      Macroscope's review found this PR approvable — This is a small, isolated composer bug fix that preserves explicit selection wrapping while allowing native dead-key composition to complete normally. It does not alter product defaults, schemas, deployment, or static-analysis behavior.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review Change StackReview Change Stack

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

      Review profile: CHILL

      Plan: Advanced

      Run ID: 87903b6b-ee8a-4a8e-9e80-efd3a4759746

      📥 Commits

      Reviewing files that changed from the base of the PR and between d6f291303ddc0c9a14f570266a4d9eff6d431593 and 3673163dc959a88c9718251a269585fb35f25f90.

      📒 Files selected for processing (1)
      • apps/web/src/components/ComposerPromptEditorTiptap.tsx

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


      📝 Walkthrough

      Walkthrough

      The prompt editor now skips surrounding-marker logic during composition, with non-text selections, empty selections, or mismatched input ranges. Existing wrapping checks remain for explicitly selected text.

      Changes

      Prompt composition handling

      Layer / File(s)Summary
      Guard explicit text input handling
      apps/web/src/components/ComposerPromptEditorTiptap.tsx
      handleTextInput returns false for composing input, non-TextSelection selections, empty selections, or ranges that do not match the input range. Existing single-character and SURROUND_CLOSE checks remain unchanged.

      Priority: ⬇️ Low

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

      Change: Bug fix

      Suggested reviewers: juliusmarminge

      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly identifies the dead-key quote duplication fix, which is the main change in the pull request.
      Description check✅ PassedThe description explains what changed, why the change is needed, and that there are no UI changes. It also includes validation results and confirms that the change is small and focused. The descriptio…
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR

      Comment `@coderabbitai help` to get the list of available commands.
    4. Since v0.0.43 made the Tiptap composer the default (#12160), this affects every US-International (dead-key) user in everyday typing, not only quote + Space. On v0.0.44 (Linux, Hyprland on Wayland, layout us variant intl), typing I've in the composer produces a doubled apostrophe. In the 0.0.44 bundle the surround handleTextInput in ComposerPromptEditorTiptap still has no composition guard, so the dead-key composition range (from !== to) is wrapped as if it were a selection, which is exactly what this PR fixes.

      Could this be merged and included in the next release?

    5. Note

      This comment is posted by Julius' dot

      This changes composer text entry, but the PR supplies no before/after images or interaction recording. The written manual checks cover useful cases; please show quote plus Space, quote plus vowel, and explicit-selection wrapping with a US International layout in a short comparison recording, as required by verification, then request reconsideration.

    6. juliusmarminge closed this

Sign in to join this conversation.