Skip to content

fix(iOS): merge inline style with plain text - #722

Merged
kacperzolkiewski merged 1 commit into
mainfrom
@kacperzolkiewski/fix-merging-inline-styles
Jul 23, 2026
Merged

kacperzolkiewski merged 1 commit into
mainfrom
@kacperzolkiewski/fix-merging-inline-styles

Conversation

@kacperzolkiewski

@kacperzolkiewski kacperzolkiewski commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes merging inline style with plain text.
This regression was introduced in this PR: #551

Test Plan

  1. run example app
  2. toggle bold
  3. type first line
  4. toggle off bold
  5. type second
  6. go with the cursor before second and remove last bolded letter
  7. bold style should not exceed on second word

Screenshots / Videos

Before:

Screen.Recording.2026-07-23.at.10.25.53.mov

After:

Screen.Recording.2026-07-23.at.10.26.17.mov

Compatibility

OS Implemented
iOS
Android
Web

Checklist

  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

Copilot AI 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.

Pull request overview

Fixes an iOS regression where inline meta-attributes (e.g., bold) could incorrectly “bleed” into adjacent plain text when edits involve replacements/deletions, and adds an E2E flow to validate the behavior.

Changes:

  • iOS: restricts attribute-capture logic during shouldChangeTextInRange to avoid capturing on deletions.
  • E2E: adds a Maestro flow reproducing and asserting the inline-style merge scenario via screenshot.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.

File Description
ios/EnrichedTextInputView.mm Adjusts attribute capture conditions during text replacement to prevent style leakage on iOS.
.maestro/enrichedInput/flows/inline_styles_merge.yaml Adds an automated Maestro flow to reproduce/assert correct inline-style merge behavior.
Comments suppressed due to low confidence (1)

ios/EnrichedTextInputView.mm:1929

  • attributesAtIndex: will throw if range.location is out of bounds. Also, when this method returns NO (e.g. for submit/return handling), _capturedAttributesBeforeChange is left set and can be incorrectly applied to the next edit in didProcessEditing:. Consider guarding the index and clearing the captured attributes before early NO returns.
  // replacement. Only capture for genuine replacements (text.length > 0), not
  // for deletions/backspace (text.length == 0).
  if (range.length > 0 && text.length > 0) {
    _capturedAttributesBeforeChange =
        [textView.textStorage attributesAtIndex:range.location
                                 effectiveRange:NULL];
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kacperzolkiewski
kacperzolkiewski merged commit 982c0ca into main Jul 23, 2026
9 checks passed
@kacperzolkiewski
kacperzolkiewski deleted the @kacperzolkiewski/fix-merging-inline-styles branch July 23, 2026 09:19
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.

3 participants