fix: render additional spaces after list markers

This commit is contained in:
Valdemar Lorenzen
2026-10-19 13:40:17 +02:00
parent bbee699cc8
commit efabd3ae18
3 changed files with 76 additions and 18 deletions
+6 -5
View File
@@ -522,15 +522,16 @@ final class NotesTextView: NSTextView, @MainActor NSLayoutManagerDelegate {
style.tabStops = []
style.defaultTabInterval = 4 * space
storage.addAttribute(.paragraphStyle, value: style, range: paragraph)
var end = NSMaxRange(task.range)
while end < NSMaxRange(paragraph) && (source.character(at: end) == 32 || source.character(at: end) == 9) { end += 1 }
storage.addAttribute(listWhitespace, value: true,
range: NSRange(location: NSMaxRange(task.range), length: end - NSMaxRange(task.range)))
let separator = NSMaxRange(task.range)
if separator < NSMaxRange(paragraph), source.character(at: separator) == 32 || source.character(at: separator) == 9 {
storage.addAttribute(listWhitespace, value: true,
range: NSRange(location: separator, length: 1))
}
(task.attachment.attachmentCell as? ListAttachmentCell)?.columnWidth = column
task.attachment.bounds.size.width = column
}
storage.endEditing()
// Whitespace remains editable source, but occupies no part of the native marker column.
// Only the required separator is hidden; additional whitespace is visible item-body text.
layoutManager.invalidateGlyphs(forCharacterRange: range, changeInLength: 0, actualCharacterRange: nil)
}