mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-19 07:07:18 +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.
|
- Update document icons.
|
||||||
- Detect the line ending in documents more intelligently.
|
- 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.
|
- 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.
|
- 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.
|
- 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.
|
- Adjust the vertical position of line numbers on printing.
|
||||||
|
@ -28,6 +28,10 @@ import AppKit.NSColor
|
|||||||
|
|
||||||
final class IncompatibleCharacterFormatter: Formatter {
|
final class IncompatibleCharacterFormatter: Formatter {
|
||||||
|
|
||||||
|
private let invisibleCategories: Set<Unicode.GeneralCategory> = [.control, .spaceSeparator, .lineSeparator]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// MARK: Formatter Function
|
// MARK: Formatter Function
|
||||||
|
|
||||||
/// convert to plain string
|
/// convert to plain string
|
||||||
@ -44,7 +48,7 @@ final class IncompatibleCharacterFormatter: Formatter {
|
|||||||
let string = self.string(for: obj),
|
let string = self.string(for: obj),
|
||||||
string.unicodeScalars.compareCount(with: 1) == .equal,
|
string.unicodeScalars.compareCount(with: 1) == .equal,
|
||||||
let unicode = string.unicodeScalars.first,
|
let unicode = string.unicodeScalars.first,
|
||||||
unicode.properties.generalCategory == .control
|
self.invisibleCategories.contains(unicode.properties.generalCategory)
|
||||||
else { return nil }
|
else { return nil }
|
||||||
|
|
||||||
let attributes = (attrs ?? [:]).merging([.foregroundColor: NSColor.tertiaryLabelColor]) { $1 }
|
let attributes = (attrs ?? [:]).merging([.foregroundColor: NSColor.tertiaryLabelColor]) { $1 }
|
||||||
|
Loading…
Reference in New Issue
Block a user