Fixed the bug where tapping the send button while inline text prediction has uncommitted text messes up the message

This commit is contained in:
Rahul Roy 2026-04-11 02:40:47 +09:00
parent be6c32ef9c
commit d3a279a9a2
No known key found for this signature in database
GPG key ID: A4E8E61FF87F09E8

View file

@ -5339,6 +5339,10 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
}
@objc func sendButtonPressed() {
if let textInputNode = self.textInputNode, let textRange = textInputNode.textView.markedTextRange {
textInputNode.textView.replace(textRange, withText: "")
}
if let textInputNode = self.textInputNode, let presentationInterfaceState = self.presentationInterfaceState, let editMessage = presentationInterfaceState.interfaceState.editMessage, let inputTextMaxLength = editMessage.inputTextMaxLength {
let textCount = Int32(textInputNode.textView.text.count)
let remainingCount = inputTextMaxLength - textCount