merge integration
This commit is contained in:
commit
77bf5a113c
|
|
@ -36,8 +36,10 @@ class MarkdownLayoutManager: NSLayoutManager {
|
|||
drawBlockquoteBorder(glyphRange: glyphRange, origin: origin, container: textContainer)
|
||||
case .horizontalRule:
|
||||
drawHorizontalRule(glyphRange: glyphRange, origin: origin, container: textContainer)
|
||||
case .checkbox, .tableBlock:
|
||||
case .checkbox:
|
||||
break
|
||||
case .tableBlock:
|
||||
drawTableBackground(glyphRange: glyphRange, origin: origin, container: textContainer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -59,6 +61,8 @@ class MarkdownLayoutManager: NSLayoutManager {
|
|||
drawCheckbox(checked: checked, glyphRange: glyphRange, origin: origin, container: textContainer)
|
||||
case .horizontalRule:
|
||||
skipRanges.append(glyphRange)
|
||||
case .tableBlock:
|
||||
skipRanges.append(glyphRange)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
@ -152,6 +156,17 @@ class MarkdownLayoutManager: NSLayoutManager {
|
|||
}
|
||||
}
|
||||
|
||||
private func drawTableBackground(glyphRange: NSRange, origin: NSPoint, container: NSTextContainer) {
|
||||
var rect = boundingRect(forGlyphRange: glyphRange, in: container)
|
||||
rect.origin.x = origin.x + 4
|
||||
rect.origin.y += origin.y
|
||||
rect.size.width = container.containerSize.width - 8
|
||||
|
||||
let path = NSBezierPath(roundedRect: rect, xRadius: 4, yRadius: 4)
|
||||
Theme.current.base.setFill()
|
||||
path.fill()
|
||||
}
|
||||
|
||||
private func drawTableBorders(glyphRange: NSRange, columns: Int, origin: NSPoint, container: NSTextContainer) {
|
||||
guard columns > 0 else { return }
|
||||
var rect = boundingRect(forGlyphRange: glyphRange, in: container)
|
||||
|
|
@ -2439,8 +2454,8 @@ private func highlightFootnoteDefinition(textStorage: NSTextStorage, lineRange:
|
|||
// MARK: - Tables
|
||||
|
||||
private func highlightTableLine(_ trimmed: String, lineRange: NSRange, textStorage: NSTextStorage, palette: CatppuccinPalette, baseFont: NSFont, isHeader: Bool, isSeparator: Bool) {
|
||||
textStorage.addAttribute(.foregroundColor, value: palette.base, range: lineRange)
|
||||
textStorage.addAttribute(.font, value: NSFont.systemFont(ofSize: 0.01), range: lineRange)
|
||||
textStorage.addAttribute(.foregroundColor, value: NSColor.clear, range: lineRange)
|
||||
textStorage.addAttribute(.font, value: baseFont, range: lineRange)
|
||||
}
|
||||
|
||||
// MARK: - Lists and Horizontal Rules
|
||||
|
|
|
|||
Loading…
Reference in New Issue