diff options
author | 2019-02-15 21:10:58 +0100 | |
---|---|---|
committer | 2019-02-16 17:18:10 +0530 | |
commit | 6f7214ff383d336511df32543275fd94ec8e955c (patch) | |
tree | 65ed464701ed52751bdb058252d782e79e6e0b74 /WireGuard/WireGuard/UI/macOS/View | |
parent | ConfTextStorage: Let's keep the AllowedIPs and DNS servers as strings (diff) | |
download | wireguard-apple-6f7214ff383d336511df32543275fd94ec8e955c.tar.xz wireguard-apple-6f7214ff383d336511df32543275fd94ec8e955c.zip |
ConfTextStorage: lowercase only once
Also fix submodule regression.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuard/UI/macOS/View')
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift b/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift index caa2bc4..077ee1e 100644 --- a/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift +++ b/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift @@ -100,14 +100,13 @@ class ConfTextStorage: NSTextStorage { resetLastPeer() while spans.pointee.type != HighlightEnd { let span = spans.pointee - var substring = backingStore.attributedSubstring(from: NSRange(location: span.start, length: span.len)).string + var substring = backingStore.attributedSubstring(from: NSRange(location: span.start, length: span.len)).string.lowercased() if span.type == HighlightError { resetLastPeer() return - } - if span.type == HighlightSection { - if substring.lowercased() == "[peer]" { + } else if span.type == HighlightSection { + if substring == "[peer]" { if hasOnePeer { resetLastPeer() return @@ -115,7 +114,7 @@ class ConfTextStorage: NSTextStorage { hasOnePeer = true } } else if span.type == HighlightField { - fieldType = FieldType(rawValue: substring.lowercased()) + fieldType = FieldType(rawValue: substring) } else if span.type == HighlightIP && fieldType == .dns { lastOnePeerDNSServers.append(substring) } else if span.type == HighlightIP && fieldType == .allowedips { |