mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Inline attachments anchored their left edge at CTLineGetOffsetForStringIndex(line, range.location), which is the glyph's LEFT edge for LTR runs but its RIGHT edge for RTL runs (string index increases leftward). On an RTL line (e.g. an Arabic thinking block) this shoved emoji/images/formulas ~one advance (~24pt) too far right while the CoreText-drawn text stayed correct. Add v2LeadingOffsetForRange(_:range:), which returns min(offset(start), offset(end)) with directional-boundary secondary-offset handling — the true leading edge in both directions. Mirrors Display.TextNode.addEmbeddedItem and the strikethrough/underline/spoiler decorations already in this file (which used the min/abs form; the inline attachments had regressed to a single offset). Applied at all 5 sites: the emoji/image/formula display frames and the emoji/image characterRect (reveal mask). Widths unchanged; only x corrected. LTR is byte-identical. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| Sources | ||
| BUILD | ||