]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
macOS: Better highlighter default value and move c implementation
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 21 Jan 2019 21:22:20 +0000 (22:22 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 21 Jan 2019 21:22:20 +0000 (22:22 +0100)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
WireGuard/WireGuard.xcodeproj/project.pbxproj
WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift
WireGuard/WireGuard/UI/macOS/View/highlighter.c [moved from WireGuard/WireGuard/UI/macOS/highlighter.c with 100% similarity]
WireGuard/WireGuard/UI/macOS/View/highlighter.h [moved from WireGuard/WireGuard/UI/macOS/highlighter.h with 100% similarity]

index c63c721d7d46a56853679a3b974b5b8a29f3ac95..943f5a906f06a14fe45d831410150d843118b093 100644 (file)
                6F4DD16921DA556600690EAE /* View */ = {
                        isa = PBXGroup;
                        children = (
+                               5F52D0C021E378C000283CEA /* highlighter.h */,
+                               5F52D0C121E378C000283CEA /* highlighter.c */,
                                6F4DD16A21DA558800690EAE /* TunnelListRow.swift */,
                                6F613D9A21DE33B8004B217A /* KeyValueRow.swift */,
                                5F52D0BA21E3781B00283CEA /* ConfTextView.swift */,
                                6FB1BD6721D2607E00A991BF /* WireGuard.entitlements */,
                                6F4DD16721DA552B00690EAE /* NSTableView+Reuse.swift */,
                                5F52D0BE21E3788900283CEA /* NSColor+Hex.swift */,
-                               5F52D0C021E378C000283CEA /* highlighter.h */,
-                               5F52D0C121E378C000283CEA /* highlighter.c */,
                                6FFACD1E21E4D89600E9A2A5 /* ParseError+WireGuardAppError.swift */,
                        );
                        path = macOS;
index fb8a382efde01f3b8c7cb149cc4fb455f451f574..688913c2d8fd4a1b9d37f4a0b06cd38a67b39d15 100644 (file)
@@ -101,7 +101,7 @@ class ConfTextStorage: NSTextStorage {
 
             let range = NSRange(location: span.start, length: span.len)
             backingStore.setAttributes(nonColorAttributes(for: span.type), range: range)
-            let color = textColorTheme.colorMap[span.type.rawValue] ?? textColorTheme.defaultColor
+            let color = textColorTheme.colorMap[span.type.rawValue, default: textColorTheme.defaultColor]
             backingStore.addAttribute(.foregroundColor, value: color, range: range)
 
             if span.type == HighlightError {