ConfTextStorage: lowercase only once

Also fix submodule regression.
This commit is contained in:
Jason A. Donenfeld 2019-02-15 21:10:58 +01:00 committed by Roopesh Chander
parent 89c108d00f
commit 2a4e4e798a
2 changed files with 5 additions and 6 deletions

View File

@ -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 {

@ -1 +1 @@
Subproject commit c4b43e35a772305858e610d879c2b9d47f4d9866
Subproject commit f7170e5de2065f37bac647484b34711db4797394