Skip to content

Commit fe24512

Browse files
committed
fix: iOS - highlighting multiline mentions
1 parent 46ad23f commit fe24512

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

apple/MarkdownTextLayoutFragment.mm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@ - (void)drawMentions {
8282
CGFloat width = endLocation.x - startLocation.x;
8383
CGFloat x = lineBounds.origin.x + startLocation.x;
8484

85-
NSUInteger lineRelativeLocation = intersection.location - lineFragment.characterRange.location;
8685
UIFont *font = [lineFragment.attributedString attribute:NSFontAttributeName
87-
atIndex:lineRelativeLocation
86+
atIndex:intersection.location
8887
effectiveRange:NULL];
8988
CGFloat ascent = font.ascender;
9089
CGFloat descent = font.descender;
9190
CGFloat textHeight = ascent - descent;
92-
CGFloat y = (startLocation.y - ascent) / 2;
91+
CGFloat y = lineBounds.size.height * idx + (startLocation.y - ascent) / 2;
9392

9493

9594
CGRect backgroundRect = CGRectMake(x,

0 commit comments

Comments
 (0)