Fixed too much text being copied when copying chat messages (#4812)

* fix: selection copying too much

* chore: add changelog entry

* Update changelog entry

---------

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2023-09-17 14:37:02 +02:00
committed by GitHub
parent dc62e8248b
commit 3265df7661
4 changed files with 19 additions and 8 deletions
@@ -125,9 +125,9 @@ void ImageLayoutElement::addCopyTextToString(QString &str, uint32_t from,
{
str += emoteElement->getEmote()->getCopyString();
str = TwitchEmotes::cleanUpEmoteCode(str);
if (this->hasTrailingSpace())
if (this->hasTrailingSpace() && to >= 2)
{
str += " ";
str += ' ';
}
}
}
@@ -217,9 +217,9 @@ void LayeredImageLayoutElement::addCopyTextToString(QString &str, uint32_t from,
{
// cleaning is taken care in call
str += layeredEmoteElement->getCleanCopyString();
if (this->hasTrailingSpace())
if (this->hasTrailingSpace() && to >= 2)
{
str += " ";
str += ' ';
}
}
}
@@ -416,9 +416,9 @@ void TextLayoutElement::addCopyTextToString(QString &str, uint32_t from,
{
str += this->getText().mid(from, to - from);
if (this->hasTrailingSpace())
if (this->hasTrailingSpace() && to > this->getText().length())
{
str += " ";
str += ' ';
}
}