fix: retain text from input when replying (#3989)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2022-09-14 12:55:52 +02:00
committed by GitHub
parent be72d73c3d
commit 6a2c4fc098
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -978,9 +978,13 @@ void SplitInput::setReply(std::shared_ptr<MessageThread> reply,
if (this->enableInlineReplying_)
{
// Only enable reply label if inline replying
this->ui_.textEdit->setPlainText(
"@" + this->replyThread_->root()->displayName + " ");
this->ui_.textEdit->moveCursor(QTextCursor::EndOfBlock);
auto replyPrefix = "@" + this->replyThread_->root()->displayName + " ";
auto plainText = this->ui_.textEdit->toPlainText().trimmed();
if (!plainText.startsWith(replyPrefix))
{
this->ui_.textEdit->setPlainText(replyPrefix + plainText + " ");
this->ui_.textEdit->moveCursor(QTextCursor::EndOfBlock);
}
this->ui_.replyLabel->setText("Replying to @" +
this->replyThread_->root()->displayName);
}