fix: Double-space when using replies with an empty input box (#4041)

This commit is contained in:
nerix 2022-10-03 20:05:42 +02:00 committed by GitHub
parent 25bccc90b4
commit d5b8d89494
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -2,7 +2,7 @@
## Unversioned
- Major: Added support for Twitch's Chat Replies. [Wiki Page](https://wiki.chatterino.com/Features/#message-replies) (#3722, #3989)
- Major: Added support for Twitch's Chat Replies. [Wiki Page](https://wiki.chatterino.com/Features/#message-replies) (#3722, #3989, #4041)
- Major: Added multi-channel searching to search dialog via keyboard shortcut. (Ctrl+Shift+F by default) (#3694, #3875)
- Minor: Added highlights for `Elevated Messages`. (#4016)
- Minor: Removed total views from the usercard, as Twitch no longer updates the number. (#3792)

View file

@ -977,10 +977,14 @@ void SplitInput::setReply(std::shared_ptr<MessageThread> reply,
if (this->enableInlineReplying_)
{
// Only enable reply label if inline replying
auto replyPrefix = "@" + this->replyThread_->root()->displayName + " ";
auto replyPrefix = "@" + this->replyThread_->root()->displayName;
auto plainText = this->ui_.textEdit->toPlainText().trimmed();
if (!plainText.startsWith(replyPrefix))
{
if (!plainText.isEmpty())
{
replyPrefix.append(' ');
}
this->ui_.textEdit->setPlainText(replyPrefix + plainText + " ");
this->ui_.textEdit->moveCursor(QTextCursor::EndOfBlock);
}