Skip to content

Commit 7e39198

Browse files
committed
After autocompleted text is removed preceding character is not removed
1 parent f23c1b0 commit 7e39198

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

MessageViewController/MessageAutocompleteController.swift

+3
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ public final class MessageAutocompleteController: MessageTextViewListener {
248248
if let isAutocomplete = attribute[NSAttributedAutocompleteKey] as? Bool, isAutocomplete {
249249
// Remove the autocompleted substring
250250
let lowerRange = NSRange(location: 0, length: range.location + 1)
251+
var shouldPreserveTypedText = true
251252
textView.attributedText.enumerateAttribute(NSAttributedAutocompleteKey, in: lowerRange, options: .reverse, using: { (_, range, stop) in
252253

253254
// Only delete the first found range
@@ -258,7 +259,9 @@ public final class MessageAutocompleteController: MessageTextViewListener {
258259
textView.selectedRange = NSRange(location: range.location, length: 0)
259260
self.textView.textViewDidChange(textView)
260261
self.preserveTypingAttributes(for: textView)
262+
shouldPreserveTypedText = false
261263
})
264+
return shouldPreserveTypedText
262265
}
263266
}
264267
return true

0 commit comments

Comments
 (0)