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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -2,7 +2,7 @@
## Unversioned ## Unversioned
- Major: Added support for Twitch's Chat Replies. [Wiki Page](https://wiki.chatterino.com/Features/#message-replies) (#3722) - Major: Added support for Twitch's Chat Replies. [Wiki Page](https://wiki.chatterino.com/Features/#message-replies) (#3722, #3989)
- Major: Added multi-channel searching to search dialog via keyboard shortcut. (Ctrl+Shift+F by default) (#3694, #3875) - Major: Added multi-channel searching to search dialog via keyboard shortcut. (Ctrl+Shift+F by default) (#3694, #3875)
- Minor: Added option to display tabs on the right and bottom. (#3847) - Minor: Added option to display tabs on the right and bottom. (#3847)
- Minor: Added `is:first-msg` search option. (#3700) - Minor: Added `is:first-msg` search option. (#3700)

View file

@ -978,9 +978,13 @@ void SplitInput::setReply(std::shared_ptr<MessageThread> reply,
if (this->enableInlineReplying_) if (this->enableInlineReplying_)
{ {
// Only enable reply label if inline replying // Only enable reply label if inline replying
this->ui_.textEdit->setPlainText( auto replyPrefix = "@" + this->replyThread_->root()->displayName + " ";
"@" + this->replyThread_->root()->displayName + " "); auto plainText = this->ui_.textEdit->toPlainText().trimmed();
this->ui_.textEdit->moveCursor(QTextCursor::EndOfBlock); if (!plainText.startsWith(replyPrefix))
{
this->ui_.textEdit->setPlainText(replyPrefix + plainText + " ");
this->ui_.textEdit->moveCursor(QTextCursor::EndOfBlock);
}
this->ui_.replyLabel->setText("Replying to @" + this->ui_.replyLabel->setText("Replying to @" +
this->replyThread_->root()->displayName); this->replyThread_->root()->displayName);
} }