fix: Only display spaces between words in reply context (#4977)
This commit is contained in:
+1
-1
@@ -929,7 +929,7 @@ if (CHATTERINO_DEBUG_NATIVE_MESSAGES)
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(${LIBRARY_PROJECT} PUBLIC /EHsc /bigobj)
|
||||
target_compile_options(${LIBRARY_PROJECT} PUBLIC /EHsc /bigobj /utf-8)
|
||||
endif ()
|
||||
|
||||
if (APPLE AND BUILD_APP)
|
||||
|
||||
@@ -664,16 +664,23 @@ void SingleLineTextElement::addToContainer(MessageLayoutContainer &container,
|
||||
QString currentText;
|
||||
|
||||
container.first = FirstWord::Neutral;
|
||||
|
||||
bool firstIteration = true;
|
||||
for (Word &word : this->words_)
|
||||
{
|
||||
if (firstIteration)
|
||||
{
|
||||
firstIteration = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentText += ' ';
|
||||
}
|
||||
|
||||
for (const auto &parsedWord : app->emotes->emojis.parse(word.text))
|
||||
{
|
||||
if (parsedWord.type() == typeid(QString))
|
||||
{
|
||||
if (!currentText.isEmpty())
|
||||
{
|
||||
currentText += ' ';
|
||||
}
|
||||
currentText += boost::get<QString>(parsedWord);
|
||||
QString prev =
|
||||
currentText; // only increments the ref-count
|
||||
@@ -714,7 +721,8 @@ void SingleLineTextElement::addToContainer(MessageLayoutContainer &container,
|
||||
|
||||
container.addElementNoLineBreak(
|
||||
(new ImageLayoutElement(*this, image, emoteSize))
|
||||
->setLink(this->getLink()));
|
||||
->setLink(this->getLink())
|
||||
->setTrailingSpace(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -723,9 +731,6 @@ void SingleLineTextElement::addToContainer(MessageLayoutContainer &container,
|
||||
// Add the last of the pending message text to the container.
|
||||
if (!currentText.isEmpty())
|
||||
{
|
||||
// Remove trailing space.
|
||||
currentText = currentText.trimmed();
|
||||
|
||||
int width = metrics.horizontalAdvance(currentText);
|
||||
container.addElementNoLineBreak(
|
||||
getTextLayoutElement(currentText, width, false));
|
||||
|
||||
@@ -152,6 +152,12 @@ namespace chatterino {
|
||||
|
||||
void Emojis::load()
|
||||
{
|
||||
if (this->loaded_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this->loaded_ = true;
|
||||
|
||||
this->loadEmojis();
|
||||
|
||||
this->sortEmojis();
|
||||
|
||||
@@ -80,6 +80,8 @@ private:
|
||||
// Maps the first character of the emoji unicode string to a vector of
|
||||
// possible emojis
|
||||
QMap<QChar, QVector<std::shared_ptr<EmojiData>>> emojiFirstByte_;
|
||||
|
||||
bool loaded_ = false;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user