Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tonisevener committed Dec 15, 2023
1 parent 7ac0a3f commit d0201d5
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,21 @@ - (BOOL)attributedString:(NSMutableAttributedString *)attributedString isHorizon
}

} else {
__block NSRange unionRange = NSMakeRange(NSNotFound, 0);
[attributedString enumerateAttributesInRange:range options:nil usingBlock:^(NSDictionary<NSAttributedStringKey,id> * _Nonnull attrs, NSRange loopRange, BOOL * _Nonnull stop) {
if ((attrs[WKSourceEditorCustomKeyContentReference] != nil) &&
(loopRange.location == range.location && loopRange.length == range.length)) {
isContentKey = YES;
stop = YES;
if (attrs[WKSourceEditorCustomKeyContentReference] != nil) {
if (unionRange.location == NSNotFound) {
unionRange = loopRange;
} else {
unionRange = NSUnionRange(unionRange, loopRange);
}
stop = YES;
}
}];

if (NSEqualRanges(unionRange, range)) {
isContentKey = YES;
}
}

return isContentKey;
Expand Down

0 comments on commit d0201d5

Please sign in to comment.