fix: don't clear message when closing reply (#6145)
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
- Bugfix: Fixed scrolling now working on inputs in the settings. (#6128)
|
- Bugfix: Fixed scrolling now working on inputs in the settings. (#6128)
|
||||||
- Bugfix: Make reply-cancel button less coarse-grained. (#6106)
|
- Bugfix: Make reply-cancel button less coarse-grained. (#6106)
|
||||||
- Bugfix: Fixed missing BetterTTV live updates of emotes. (#6132)
|
- Bugfix: Fixed missing BetterTTV live updates of emotes. (#6132)
|
||||||
|
- Bugfix: Fixed message contents being cleared when using the close button for replies. (#6145)
|
||||||
- Bugfix: Handle <kbd>CMD</kbd> + <kbd>BACKSPACE</kbd> behavior explicitly in main chat dialog input for macOS. (#6111)
|
- Bugfix: Handle <kbd>CMD</kbd> + <kbd>BACKSPACE</kbd> behavior explicitly in main chat dialog input for macOS. (#6111)
|
||||||
- Bugfix: Fixed a small typo in the settings page. (#6134)
|
- Bugfix: Fixed a small typo in the settings page. (#6134)
|
||||||
- Bugfix: Fixed some Twitch commands not getting tab-completed correctly. (#6143)
|
- Bugfix: Fixed some Twitch commands not getting tab-completed correctly. (#6143)
|
||||||
|
|||||||
@@ -190,10 +190,10 @@ void SplitInput::initLayout()
|
|||||||
this->openEmotePopup();
|
this->openEmotePopup();
|
||||||
});
|
});
|
||||||
|
|
||||||
// clear input and remove reply target
|
// remove reply target
|
||||||
QObject::connect(this->ui_.cancelReplyButton, &EffectLabel::leftClicked,
|
QObject::connect(this->ui_.cancelReplyButton, &EffectLabel::leftClicked,
|
||||||
[this] {
|
[this] {
|
||||||
this->clearInput();
|
this->setReply(nullptr);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Forward selection change signal
|
// Forward selection change signal
|
||||||
@@ -1146,53 +1146,64 @@ void SplitInput::setReply(MessagePtr target)
|
|||||||
this->ui_.textEdit->resetCompletion();
|
this->ui_.textEdit->resetCompletion();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(target != nullptr);
|
if (target != nullptr)
|
||||||
this->replyTarget_ = std::move(target);
|
|
||||||
|
|
||||||
if (this->enableInlineReplying_)
|
|
||||||
{
|
{
|
||||||
this->ui_.replyMessage->setWidth(this->replyMessageWidth());
|
this->replyTarget_ = std::move(target);
|
||||||
this->ui_.replyMessage->setMessage(this->replyTarget_);
|
|
||||||
|
|
||||||
// add spacing between reply box and input box
|
if (this->enableInlineReplying_)
|
||||||
this->ui_.vbox->setSpacing(this->marginForTheme());
|
|
||||||
if (!this->isHidden())
|
|
||||||
{
|
{
|
||||||
// update maximum height to give space for message
|
this->ui_.replyMessage->setWidth(this->replyMessageWidth());
|
||||||
this->setMaximumHeight(this->scaledMaxHeight());
|
this->ui_.replyMessage->setMessage(this->replyTarget_);
|
||||||
}
|
|
||||||
|
|
||||||
// Only enable reply label if inline replying
|
// add spacing between reply box and input box
|
||||||
auto replyPrefix = "@" + this->replyTarget_->displayName;
|
this->ui_.vbox->setSpacing(this->marginForTheme());
|
||||||
auto plainText = this->ui_.textEdit->toPlainText().trimmed();
|
if (!this->isHidden())
|
||||||
|
|
||||||
// This makes it so if plainText contains "@StreamerFan" and
|
|
||||||
// we are replying to "@Streamer" we don't just leave "Fan"
|
|
||||||
// in the text box
|
|
||||||
if (plainText.startsWith(replyPrefix))
|
|
||||||
{
|
|
||||||
if (plainText.length() > replyPrefix.length())
|
|
||||||
{
|
{
|
||||||
if (plainText.at(replyPrefix.length()) == ',' ||
|
// update maximum height to give space for message
|
||||||
plainText.at(replyPrefix.length()) == ' ')
|
this->setMaximumHeight(this->scaledMaxHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only enable reply label if inline replying
|
||||||
|
auto replyPrefix = "@" + this->replyTarget_->displayName;
|
||||||
|
auto plainText = this->ui_.textEdit->toPlainText().trimmed();
|
||||||
|
|
||||||
|
// This makes it so if plainText contains "@StreamerFan" and
|
||||||
|
// we are replying to "@Streamer" we don't just leave "Fan"
|
||||||
|
// in the text box
|
||||||
|
if (plainText.startsWith(replyPrefix))
|
||||||
|
{
|
||||||
|
if (plainText.length() > replyPrefix.length())
|
||||||
{
|
{
|
||||||
plainText.remove(0, replyPrefix.length() + 1);
|
if (plainText.at(replyPrefix.length()) == ',' ||
|
||||||
|
plainText.at(replyPrefix.length()) == ' ')
|
||||||
|
{
|
||||||
|
plainText.remove(0, replyPrefix.length() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plainText.remove(0, replyPrefix.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
if (!plainText.isEmpty() && !plainText.startsWith(' '))
|
||||||
{
|
{
|
||||||
plainText.remove(0, replyPrefix.length());
|
replyPrefix.append(' ');
|
||||||
}
|
}
|
||||||
|
this->ui_.textEdit->setPlainText(replyPrefix + plainText + " ");
|
||||||
|
this->ui_.textEdit->moveCursor(QTextCursor::EndOfBlock);
|
||||||
|
this->ui_.textEdit->resetCompletion();
|
||||||
|
this->ui_.replyLabel->setText("Replying to @" +
|
||||||
|
this->replyTarget_->displayName);
|
||||||
}
|
}
|
||||||
if (!plainText.isEmpty() && !plainText.startsWith(' '))
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->replyTarget_.reset();
|
||||||
|
|
||||||
|
if (this->enableInlineReplying_)
|
||||||
{
|
{
|
||||||
replyPrefix.append(' ');
|
this->clearReplyTarget();
|
||||||
}
|
}
|
||||||
this->ui_.textEdit->setPlainText(replyPrefix + plainText + " ");
|
|
||||||
this->ui_.textEdit->moveCursor(QTextCursor::EndOfBlock);
|
|
||||||
this->ui_.textEdit->resetCompletion();
|
|
||||||
this->ui_.replyLabel->setText("Replying to @" +
|
|
||||||
this->replyTarget_->displayName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user