fix HR double-render: skip glyph drawing for horizontal rules
This commit is contained in:
parent
a1ca3817ba
commit
63e926893b
|
|
@ -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 }
|
||||
skipRanges.append(glyphRange)
|
||||
drawCheckbox(checked: checked, glyphRange: glyphRange, origin: origin, container: textContainer)
|
||||
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue