ConfTextStorage: lowercase only once
Also fix submodule regression. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
4c88f477a2
commit
6f7214ff38
|
@ -100,14 +100,13 @@ class ConfTextStorage: NSTextStorage {
|
||||||
resetLastPeer()
|
resetLastPeer()
|
||||||
while spans.pointee.type != HighlightEnd {
|
while spans.pointee.type != HighlightEnd {
|
||||||
let span = spans.pointee
|
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 {
|
if span.type == HighlightError {
|
||||||
resetLastPeer()
|
resetLastPeer()
|
||||||
return
|
return
|
||||||
}
|
} else if span.type == HighlightSection {
|
||||||
if span.type == HighlightSection {
|
if substring == "[peer]" {
|
||||||
if substring.lowercased() == "[peer]" {
|
|
||||||
if hasOnePeer {
|
if hasOnePeer {
|
||||||
resetLastPeer()
|
resetLastPeer()
|
||||||
return
|
return
|
||||||
|
@ -115,7 +114,7 @@ class ConfTextStorage: NSTextStorage {
|
||||||
hasOnePeer = true
|
hasOnePeer = true
|
||||||
}
|
}
|
||||||
} else if span.type == HighlightField {
|
} else if span.type == HighlightField {
|
||||||
fieldType = FieldType(rawValue: substring.lowercased())
|
fieldType = FieldType(rawValue: substring)
|
||||||
} else if span.type == HighlightIP && fieldType == .dns {
|
} else if span.type == HighlightIP && fieldType == .dns {
|
||||||
lastOnePeerDNSServers.append(substring)
|
lastOnePeerDNSServers.append(substring)
|
||||||
} else if span.type == HighlightIP && fieldType == .allowedips {
|
} else if span.type == HighlightIP && fieldType == .allowedips {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c4b43e35a772305858e610d879c2b9d47f4d9866
|
Subproject commit f7170e5de2065f37bac647484b34711db4797394
|
Loading…
Reference in New Issue