UI: macOS: Fix UTF-8 and UTF-16 conversions in highlighter code
NSString uses UTF-16 internally, while String uses UTF-8 in Swift 5. Signed-off-by: Andrej Mihajlov <and@mullvad.net>
This commit is contained in:
committed by
Jason A. Donenfeld
parent
403ee63615
commit
9269c7c1c1
@@ -70,7 +70,7 @@ class ConfTextView: NSTextView {
|
||||
}
|
||||
|
||||
func setConfText(_ text: String) {
|
||||
let fullTextRange = NSRange(location: 0, length: (string as NSString).length)
|
||||
let fullTextRange = NSRange(..<string.endIndex, in: string)
|
||||
if shouldChangeText(in: fullTextRange, replacementString: text) {
|
||||
replaceCharacters(in: fullTextRange, with: text)
|
||||
didChangeText()
|
||||
|
||||
Reference in New Issue
Block a user