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
+5
View File
@@ -306,6 +306,11 @@ ChannelView &Split::getChannelView()
return *this->view_;
}
SplitInput &Split::getInput()
{
return *this->input_;
}
void Split::updateInputPlaceholder()
{
if (!this->getChannel()->isTwitchChannel())
+1
View File
@@ -47,6 +47,7 @@ public:
pajlada::Signals::NoArgSignal focusLost;
ChannelView &getChannelView();
SplitInput &getInput();
IndirectChannel getIndirectChannel();
ChannelPtr getChannel();
+10 -2
View File
@@ -8,6 +8,7 @@
#include "singletons/Settings.hpp"
#include "singletons/Theme.hpp"
#include "util/Clamp.hpp"
#include "util/Helpers.hpp"
#include "util/LayoutCreator.hpp"
#include "widgets/Notebook.hpp"
#include "widgets/Scrollbar.hpp"
@@ -568,8 +569,10 @@ void SplitInput::insertCompletionText(const QString &input_)
}
else if (text[i] == '@')
{
input = "@" + input_ +
(getSettings()->mentionUsersWithComma ? ", " : " ");
const auto userMention =
formatUserMention(input_, edit.isFirstWord(),
getSettings()->mentionUsersWithComma);
input = "@" + userMention + " ";
done = true;
}
@@ -595,6 +598,11 @@ void SplitInput::clearSelection()
this->ui_.textEdit->setTextCursor(c);
}
bool SplitInput::isEditFirstWord() const
{
return this->ui_.textEdit->isFirstWord();
}
QString SplitInput::getInputText() const
{
return this->ui_.textEdit->toPlainText();
+1
View File
@@ -28,6 +28,7 @@ public:
SplitInput(Split *_chatWidget);
void clearSelection();
bool isEditFirstWord() const;
QString getInputText() const;
void insertText(const QString &text);