mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-17 14:17:13 +03:00
Display code points for incompatible whitespaces
This commit is contained in:
parent
e28c7ef582
commit
7f5ab0714d
@ -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.
|
||||
|
@ -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 }
|
||||
|
Loading…
Reference in New Issue
Block a user