Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b63c230

Browse files
committedApr 2, 2018
After autocompleted text is removed preceeding character is not removed
1 parent f23c1b0 commit b63c230

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)
Please sign in to comment.