parent
8c4ef3caa6
commit
62a9535394
|
@ -147,6 +147,10 @@ struct ComposeContentWarningTextField: UIViewRepresentable {
|
||||||
let selectedRangeStartUTF16 = textField.offset(from: textField.beginningOfDocument, to: selectedRange.start)
|
let selectedRangeStartUTF16 = textField.offset(from: textField.beginningOfDocument, to: selectedRange.start)
|
||||||
let cursorIndex = text.utf16.index(text.startIndex, offsetBy: selectedRangeStartUTF16)
|
let cursorIndex = text.utf16.index(text.startIndex, offsetBy: selectedRangeStartUTF16)
|
||||||
|
|
||||||
|
guard cursorIndex != text.startIndex else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var lastWordStartIndex = text.index(before: cursorIndex)
|
var lastWordStartIndex = text.index(before: cursorIndex)
|
||||||
while true {
|
while true {
|
||||||
let c = text[lastWordStartIndex]
|
let c = text[lastWordStartIndex]
|
||||||
|
|
Loading…
Reference in New Issue