fix: Only display spaces between words in reply context (#4977)

This commit is contained in:
nerix
2023-11-26 11:15:35 +01:00
committed by GitHub
parent 1a685d7bd0
commit 854032fce9
6 changed files with 133 additions and 10 deletions
+1 -1
View File
@@ -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)
+13 -8
View File
@@ -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));
+6
View File
@@ -152,6 +152,12 @@ namespace chatterino {
void Emojis::load()
{
if (this->loaded_)
{
return;
}
this->loaded_ = true;
this->loadEmojis();
this->sortEmojis();
+2
View File
@@ -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