Files
buzz/mobile/ios
Tom Brow 1059d81fc2 fix(ios): end each bold or strikethrough run at its first closing marker (#9559)
Bold and strikethrough runs in iOS push notification bodies now end at
their first closing marker, so a message with two bold runs on one line
shows both without their markers.

Before, the run's optional group was greedy and stretched to the last
marker on the line:

| Message | Before | After |
| --- | --- | --- |
| `option **A** or option **B**` | `option A** or option **B` | `option
A or option B` |
| `~~x~~ and ~~y~~` | `x~~ and ~~y` | `x and y` |
| `**😀** and **b**` | `😀** and **b` | `😀 and b` |

The fix makes that group lazy (`(?:.*?\S)??`). Found while reviewing the
Dart port in [#9556 Dart notification
body](https://github.com/block/buzz/pull/9556), which must match these
fixtures. That PR takes the same pattern once this one lands.

### Validation

- Added tests: three shared rows in
`test-fixtures/notification-body.json`, one per row above. All three
fail with the old pattern.
- All 70 BuzzPushKit tests pass on macOS, including the other 36 fixture
rows, which are unchanged.

### Regressions

None expected. The pattern still needs non-space characters right inside
both markers and still stays on one line. It now stops at the first
closing marker where before it reached for the last one. The output
changes only where a one-character run is followed by the same marker
later on the line, for example `**a** costs 2**3`, which was `a** costs
23` and is now `a costs 2**3`. Worst-case time for unclosed markers is
unchanged (measured during review of the Dart port).

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
2026-11-17 12:04:04 -05:00
..
…