fix HR double-render: skip glyph drawing for horizontal rules

This commit is contained in:
jess 2026-04-06 13:39:02 -07:00
parent a1ca3817ba
commit 63e926893b
1 changed files with 10 additions and 3 deletions

View File

@ -49,11 +49,18 @@ class MarkdownLayoutManager: NSLayoutManager {
var skipRanges: [NSRange] = []
for block in blockRanges {
guard case .checkbox(let checked) = block.kind else { continue }
let glyphRange = self.glyphRange(forCharacterRange: block.range, actualCharacterRange: nil)
guard NSIntersectionRange(glyphRange, glyphsToShow).length > 0 else { continue }
switch block.kind {
case .checkbox(let checked):
skipRanges.append(glyphRange)
drawCheckbox(checked: checked, glyphRange: glyphRange, origin: origin, container: textContainer)
case .horizontalRule:
skipRanges.append(glyphRange)
default:
break
}
}
if skipRanges.isEmpty {