Fixed comma appended to username completion when not at the beginning of the message (#3060)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Paweł
2021-07-24 12:01:50 +02:00
committed by GitHub
parent ae9f92ded9
commit 588ed557f0
13 changed files with 97 additions and 22 deletions
+9 -2
View File
@@ -37,6 +37,7 @@
#include "singletons/WindowManager.hpp"
#include "util/Clipboard.hpp"
#include "util/DistanceBetweenPoints.hpp"
#include "util/Helpers.hpp"
#include "util/IncognitoBrowser.hpp"
#include "util/StreamerMode.hpp"
#include "util/Twitch.hpp"
@@ -48,6 +49,7 @@
#include "widgets/helper/EffectLabel.hpp"
#include "widgets/helper/SearchPopup.hpp"
#include "widgets/splits/Split.hpp"
#include "widgets/splits/SplitInput.hpp"
#define DRAW_WIDTH (this->width())
#define SELECTION_RESUME_SCROLLING_MSG_THRESHOLD 3
@@ -1804,8 +1806,9 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
}
break;
case Qt::RightButton: {
auto split = dynamic_cast<Split *>(this->parentWidget());
auto insertText = [=](QString text) {
if (auto split = dynamic_cast<Split *>(this->parentWidget()))
if (split)
{
split->insertTextToInput(text);
}
@@ -1815,7 +1818,11 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
if (link.type == Link::UserInfo)
{
const bool commaMention = getSettings()->mentionUsersWithComma;
insertText("@" + link.value + (commaMention ? ", " : " "));
const bool isFirstWord =
split && split->getInput().isEditFirstWord();
auto userMention =
formatUserMention(link.value, isFirstWord, commaMention);
insertText("@" + userMention + " ");
}
else if (link.type == Link::UserWhisper)
{