Display code points for incompatible whitespaces

This commit is contained in:
1024jp 2022-04-14 21:01:02 +09:00
parent e28c7ef582
commit 7f5ab0714d
2 changed files with 6 additions and 1 deletions

View File

@ -22,6 +22,7 @@ Change Log
- Update document icons.
- Detect the line ending in documents more intelligently.
- Rename the Incompatible Characters pane to the Warnings pane to share the pane with the inconsistent line ending list.
- Display code points instead of left blank in the incompatible character list for whitespaces.
- Locate the vertical scroller for the editor on the left side when the writing direction is right-to-left.
- Print the line numbers on the right side on printing if the writing direction is right-to-left.
- Adjust the vertical position of line numbers on printing.

View File

@ -28,6 +28,10 @@ import AppKit.NSColor
final class IncompatibleCharacterFormatter: Formatter {
private let invisibleCategories: Set<Unicode.GeneralCategory> = [.control, .spaceSeparator, .lineSeparator]
// MARK: Formatter Function
/// convert to plain string
@ -44,7 +48,7 @@ final class IncompatibleCharacterFormatter: Formatter {
let string = self.string(for: obj),
string.unicodeScalars.compareCount(with: 1) == .equal,
let unicode = string.unicodeScalars.first,
unicode.properties.generalCategory == .control
self.invisibleCategories.contains(unicode.properties.generalCategory)
else { return nil }
let attributes = (attrs ?? [:]).merging([.foregroundColor: NSColor.tertiaryLabelColor]) { $1 }