mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fix neutral elements order in multiple lines (#4173)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
330e0a99fa
commit
fe2a9ccbff
|
@ -5,6 +5,7 @@
|
||||||
- Bugfix: Fixed crash happening when QuickSwitcher is used with a popout window. (#4187)
|
- Bugfix: Fixed crash happening when QuickSwitcher is used with a popout window. (#4187)
|
||||||
- Bugfix: Fixed low contrast of text in settings tooltips. (#4188)
|
- Bugfix: Fixed low contrast of text in settings tooltips. (#4188)
|
||||||
- Bugfix: Fixed being unable to see the usercard of VIPs who have Asian language display names. (#4174)
|
- Bugfix: Fixed being unable to see the usercard of VIPs who have Asian language display names. (#4174)
|
||||||
|
- Bugfix: Fixed messages where Right-to-Left order is mixed in multiple lines. (#4173)
|
||||||
- Bugfix: Fixed the wrong right-click menu showing in the chat input box. (#4177)
|
- Bugfix: Fixed the wrong right-click menu showing in the chat input box. (#4177)
|
||||||
- Bugfix: Fixed popup windows not appearing/minimizing correctly on the Windows taskbar. (#4181)
|
- Bugfix: Fixed popup windows not appearing/minimizing correctly on the Windows taskbar. (#4181)
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ void MessageLayoutContainer::begin(int width, float scale, MessageFlags flags)
|
||||||
this->dotdotdotWidth_ = mediumFontMetrics.horizontalAdvance("...");
|
this->dotdotdotWidth_ = mediumFontMetrics.horizontalAdvance("...");
|
||||||
this->canAddMessages_ = true;
|
this->canAddMessages_ = true;
|
||||||
this->isCollapsed_ = false;
|
this->isCollapsed_ = false;
|
||||||
|
this->wasPrevReversed_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLayoutContainer::clear()
|
void MessageLayoutContainer::clear()
|
||||||
|
@ -272,7 +273,6 @@ void MessageLayoutContainer::reorderRTL(int firstTextIndex)
|
||||||
|
|
||||||
std::vector<int> correctSequence;
|
std::vector<int> correctSequence;
|
||||||
std::stack<int> swappedSequence;
|
std::stack<int> swappedSequence;
|
||||||
bool wasPrevReversed = false;
|
|
||||||
|
|
||||||
// we reverse a sequence of words if it's opposite to the text direction
|
// we reverse a sequence of words if it's opposite to the text direction
|
||||||
// the second condition below covers the possible three cases:
|
// the second condition below covers the possible three cases:
|
||||||
|
@ -291,18 +291,19 @@ void MessageLayoutContainer::reorderRTL(int firstTextIndex)
|
||||||
for (int i = startIndex; i <= endIndex; i++)
|
for (int i = startIndex; i <= endIndex; i++)
|
||||||
{
|
{
|
||||||
if (isNeutral(this->elements_[i]->getText()) &&
|
if (isNeutral(this->elements_[i]->getText()) &&
|
||||||
((this->first == FirstWord::RTL && !wasPrevReversed) ||
|
((this->first == FirstWord::RTL && !this->wasPrevReversed_) ||
|
||||||
(this->first == FirstWord::LTR && wasPrevReversed)))
|
(this->first == FirstWord::LTR && this->wasPrevReversed_)))
|
||||||
{
|
{
|
||||||
this->elements_[i]->reversedNeutral = true;
|
this->elements_[i]->reversedNeutral = true;
|
||||||
}
|
}
|
||||||
if (((this->elements_[i]->getText().isRightToLeft() !=
|
if (((this->elements_[i]->getText().isRightToLeft() !=
|
||||||
(this->first == FirstWord::RTL)) &&
|
(this->first == FirstWord::RTL)) &&
|
||||||
!isNeutral(this->elements_[i]->getText())) ||
|
!isNeutral(this->elements_[i]->getText())) ||
|
||||||
(isNeutral(this->elements_[i]->getText()) && wasPrevReversed))
|
(isNeutral(this->elements_[i]->getText()) &&
|
||||||
|
this->wasPrevReversed_))
|
||||||
{
|
{
|
||||||
swappedSequence.push(i);
|
swappedSequence.push(i);
|
||||||
wasPrevReversed = true;
|
this->wasPrevReversed_ = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -312,7 +313,7 @@ void MessageLayoutContainer::reorderRTL(int firstTextIndex)
|
||||||
swappedSequence.pop();
|
swappedSequence.pop();
|
||||||
}
|
}
|
||||||
correctSequence.push_back(i);
|
correctSequence.push_back(i);
|
||||||
wasPrevReversed = false;
|
this->wasPrevReversed_ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (!swappedSequence.empty())
|
while (!swappedSequence.empty())
|
||||||
|
|
|
@ -128,6 +128,7 @@ private:
|
||||||
int dotdotdotWidth_ = 0;
|
int dotdotdotWidth_ = 0;
|
||||||
bool canAddMessages_ = true;
|
bool canAddMessages_ = true;
|
||||||
bool isCollapsed_ = false;
|
bool isCollapsed_ = false;
|
||||||
|
bool wasPrevReversed_ = false;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<MessageLayoutElement>> elements_;
|
std::vector<std::unique_ptr<MessageLayoutElement>> elements_;
|
||||||
std::vector<Line> lines_;
|
std::vector<Line> lines_;
|
||||||
|
|
Loading…
Reference in a new issue