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] = []
|
var skipRanges: [NSRange] = []
|
||||||
for block in blockRanges {
|
for block in blockRanges {
|
||||||
guard case .checkbox(let checked) = block.kind else { continue }
|
|
||||||
let glyphRange = self.glyphRange(forCharacterRange: block.range, actualCharacterRange: nil)
|
let glyphRange = self.glyphRange(forCharacterRange: block.range, actualCharacterRange: nil)
|
||||||
guard NSIntersectionRange(glyphRange, glyphsToShow).length > 0 else { continue }
|
guard NSIntersectionRange(glyphRange, glyphsToShow).length > 0 else { continue }
|
||||||
|
|
||||||
|
switch block.kind {
|
||||||
|
case .checkbox(let checked):
|
||||||
skipRanges.append(glyphRange)
|
skipRanges.append(glyphRange)
|
||||||
drawCheckbox(checked: checked, glyphRange: glyphRange, origin: origin, container: textContainer)
|
drawCheckbox(checked: checked, glyphRange: glyphRange, origin: origin, container: textContainer)
|
||||||
|
case .horizontalRule:
|
||||||
|
skipRanges.append(glyphRange)
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if skipRanges.isEmpty {
|
if skipRanges.isEmpty {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue