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
@@ -478,6 +478,11 @@ void MessageLayoutContainer::end()
this->lines_.back().endIndex = this->elements_.size();
this->lines_.back().endCharIndex = this->charIndex_;
}
if (!this->elements_.empty())
{
this->elements_.back()->setTrailingSpace(false);
}
}
bool MessageLayoutContainer::canCollapse()
@@ -849,7 +854,7 @@ void MessageLayoutContainer::addSelectionText(QString &str, uint32_t from,
element->addCopyTextToString(str, from - index, to - index);
first = false;
if (index + indexCount > to)
if (index + indexCount >= to)
{
break;
}
@@ -857,7 +862,7 @@ void MessageLayoutContainer::addSelectionText(QString &str, uint32_t from,
}
else
{
if (index + indexCount > to)
if (index + indexCount >= to)
{
element->addCopyTextToString(str, 0, to - index);
break;