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:
@@ -11,6 +11,7 @@
|
|||||||
- Bugfix: Fixed Usercard popup not floating on tiling WMs on Linux when "Automatically close user popup when it loses focus" setting is enabled. (#3511)
|
- Bugfix: Fixed Usercard popup not floating on tiling WMs on Linux when "Automatically close user popup when it loses focus" setting is enabled. (#3511)
|
||||||
- Bugfix: Fixed selection of tabs after closing a tab when using "Live Tabs Only". (#4770)
|
- Bugfix: Fixed selection of tabs after closing a tab when using "Live Tabs Only". (#4770)
|
||||||
- Bugfix: Fixed input in reply thread popup losing focus when dragging. (#4815)
|
- Bugfix: Fixed input in reply thread popup losing focus when dragging. (#4815)
|
||||||
|
- Bugfix: Fixed too much text being copied when copying chat messages. (#4812)
|
||||||
- Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791)
|
- Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791)
|
||||||
- Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767)
|
- Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767)
|
||||||
- Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774)
|
- Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774)
|
||||||
|
|||||||
@@ -478,6 +478,11 @@ void MessageLayoutContainer::end()
|
|||||||
this->lines_.back().endIndex = this->elements_.size();
|
this->lines_.back().endIndex = this->elements_.size();
|
||||||
this->lines_.back().endCharIndex = this->charIndex_;
|
this->lines_.back().endCharIndex = this->charIndex_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this->elements_.empty())
|
||||||
|
{
|
||||||
|
this->elements_.back()->setTrailingSpace(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessageLayoutContainer::canCollapse()
|
bool MessageLayoutContainer::canCollapse()
|
||||||
@@ -849,7 +854,7 @@ void MessageLayoutContainer::addSelectionText(QString &str, uint32_t from,
|
|||||||
element->addCopyTextToString(str, from - index, to - index);
|
element->addCopyTextToString(str, from - index, to - index);
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
if (index + indexCount > to)
|
if (index + indexCount >= to)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -857,7 +862,7 @@ void MessageLayoutContainer::addSelectionText(QString &str, uint32_t from,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (index + indexCount > to)
|
if (index + indexCount >= to)
|
||||||
{
|
{
|
||||||
element->addCopyTextToString(str, 0, to - index);
|
element->addCopyTextToString(str, 0, to - index);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -125,9 +125,9 @@ void ImageLayoutElement::addCopyTextToString(QString &str, uint32_t from,
|
|||||||
{
|
{
|
||||||
str += emoteElement->getEmote()->getCopyString();
|
str += emoteElement->getEmote()->getCopyString();
|
||||||
str = TwitchEmotes::cleanUpEmoteCode(str);
|
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
|
// cleaning is taken care in call
|
||||||
str += layeredEmoteElement->getCleanCopyString();
|
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);
|
str += this->getText().mid(from, to - from);
|
||||||
|
|
||||||
if (this->hasTrailingSpace())
|
if (this->hasTrailingSpace() && to > this->getText().length())
|
||||||
{
|
{
|
||||||
str += " ";
|
str += ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -609,6 +609,11 @@ QString ChannelView::getSelectedText()
|
|||||||
: layout->getLastCharacterIndex() + 1;
|
: layout->getLastCharacterIndex() + 1;
|
||||||
|
|
||||||
layout->addSelectionText(result, from, to);
|
layout->addSelectionText(result, from, to);
|
||||||
|
|
||||||
|
if (msg != indexEnd)
|
||||||
|
{
|
||||||
|
result += '\n';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user