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:
@@ -306,6 +306,11 @@ ChannelView &Split::getChannelView()
|
||||
return *this->view_;
|
||||
}
|
||||
|
||||
SplitInput &Split::getInput()
|
||||
{
|
||||
return *this->input_;
|
||||
}
|
||||
|
||||
void Split::updateInputPlaceholder()
|
||||
{
|
||||
if (!this->getChannel()->isTwitchChannel())
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
pajlada::Signals::NoArgSignal focusLost;
|
||||
|
||||
ChannelView &getChannelView();
|
||||
SplitInput &getInput();
|
||||
|
||||
IndirectChannel getIndirectChannel();
|
||||
ChannelPtr getChannel();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
SplitInput(Split *_chatWidget);
|
||||
|
||||
void clearSelection();
|
||||
bool isEditFirstWord() const;
|
||||
QString getInputText() const;
|
||||
void insertText(const QString &text);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user