]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
Highlighter: Report each key type separately
authorRoopesh Chander <roop@roopc.net>
Tue, 8 Jan 2019 18:16:55 +0000 (23:46 +0530)
committerRoopesh Chander <roop@roopc.net>
Mon, 14 Jan 2019 09:22:34 +0000 (14:52 +0530)
Signed-off-by: Roopesh Chander <roop@roopc.net>
WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift
WireGuard/WireGuard/UI/macOS/highlighter.c
WireGuard/WireGuard/UI/macOS/highlighter.h

index 63c9cbf18009dc47f6aad957ba012f79b3edbd43..2a9d36d1993baed9bcd33fab0fd11dd685d7b1f7 100644 (file)
@@ -56,10 +56,6 @@ class ConfTextStorage: NSTextStorage {
                 .foregroundColor: theme.key,
                 .font: boldFont
             ],
-            HighlightKey.rawValue: [
-                .foregroundColor: theme.plainText,
-                .font: defaultFont
-            ],
             HighlightIP.rawValue: [
                 .foregroundColor: theme.url,
                 .font: defaultFont
index cc4a74af63d2c65294f02fccf7d0d1314ae0b8e6..ff8bf06860edb52cbce5dfdeb700791c71ca8c56 100644 (file)
@@ -470,9 +470,13 @@ static void highlight_value(struct highlight_span_array *ret, const string_span_
 {
        switch (section) {
        case PrivateKey:
+               append_highlight_span(ret, parent.s, s, is_valid_key(s) ? HighlightPrivateKey : HighlightError);
+               break;
        case PublicKey:
+               append_highlight_span(ret, parent.s, s, is_valid_key(s) ? HighlightPublicKey : HighlightError);
+               break;
        case PresharedKey:
-               append_highlight_span(ret, parent.s, s, is_valid_key(s) ? HighlightKey : HighlightError);
+               append_highlight_span(ret, parent.s, s, is_valid_key(s) ? HighlightPresharedKey : HighlightError);
                break;
        case MTU:
                append_highlight_span(ret, parent.s, s, is_valid_mtu(s) ? HighlightMTU : HighlightError);
index d88638b8385de165645acf1548d4e4264adde23b..4e5fa4cfae0337403505205ba143ab2693473541 100644 (file)
@@ -8,7 +8,9 @@
 enum highlight_type {
        HighlightSection,
        HighlightKeytype,
-       HighlightKey,
+       HighlightPrivateKey,
+       HighlightPublicKey,
+       HighlightPresharedKey,
        HighlightIP,
        HighlightCidr,
        HighlightHost,