diff --git a/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIViewController+Navigation.m b/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIViewController+Navigation.m index 64f28b345a..4000be50b1 100644 --- a/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIViewController+Navigation.m +++ b/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIViewController+Navigation.m @@ -317,7 +317,14 @@ static NSString *TGEncodeText(NSString *string, int key) } void applyKeyboardAutocorrection(UITextView * _Nonnull textView) { + NSRange rangeCopy = textView.selectedRange; + NSRange fakeRange = rangeCopy; + if (fakeRange.location != 0) { + fakeRange.location--; + } [textView unmarkText]; + [textView setSelectedRange:fakeRange]; + [textView setSelectedRange:rangeCopy]; } @interface AboveStatusBarWindowController : UIViewController