aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/WireGuard')
-rw-r--r--WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift9
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 caa2bc44..077ee1ee 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 {