diff --git a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m index 3c46a6912..74c5df40a 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m @@ -606,7 +606,14 @@ const CGFloat kMaxTextViewHeight = 98; { // compute new height assuming width is unchanged CGSize currentSize = textView.frame.size; - CGFloat newHeight = [self clampedHeightWithTextView:textView fixedWidth:currentSize.width]; + + CGFloat fixedWidth = currentSize.width; + CGSize contentSize = [textView sizeThatFits:CGSizeMake(fixedWidth, CGFLOAT_MAX)]; + + // `textView.contentSize` isn't accurate when restoring a multiline draft, so we compute it here. + textView.contentSize = contentSize; + + CGFloat newHeight = CGFloatClamp(contentSize.height, kMinTextViewHeight, kMaxTextViewHeight); if (newHeight != self.textViewHeight) { self.textViewHeight = newHeight; @@ -616,14 +623,6 @@ const CGFloat kMaxTextViewHeight = 98; } } -- (CGFloat)clampedHeightWithTextView:(UITextView *)textView fixedWidth:(CGFloat)fixedWidth -{ - CGSize fixedWidthSize = CGSizeMake(fixedWidth, CGFLOAT_MAX); - CGSize contentSize = [textView sizeThatFits:fixedWidthSize]; - - return CGFloatClamp(contentSize.height, kMinTextViewHeight, kMaxTextViewHeight); -} - #pragma mark QuotedReplyPreviewViewDelegate - (void)quotedReplyPreviewDidPressCancel:(QuotedReplyPreview *)preview