mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fix spacing issue with mentions inside RTL text (#4677)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
839ba60fd8
commit
c907f2b170
|
@ -8,6 +8,7 @@
|
|||
- Minor: Improved editing hotkeys. (#4628)
|
||||
- Minor: The input completion and quick switcher are now styled to match your theme. (#4671)
|
||||
- Bugfix: Fixed generation of crashdumps by the browser-extension process when the browser was closed. (#4667)
|
||||
- Bugfix: Fix spacing issue with mentions inside RTL text. (#4677)
|
||||
- Bugfix: Fixed a crash when opening and closing a reply thread and switching the user. (#4675)
|
||||
- Dev: Added command to set Qt's logging filter/rules at runtime (`/c2-set-logging-rules`). (#4637)
|
||||
- Dev: Added the ability to see & load custom themes from the Themes directory. No stable promises are made of this feature, changes might be made that breaks custom themes without notice. (#4570)
|
||||
|
|
|
@ -276,17 +276,24 @@ void MessageLayoutContainer::reorderRTL(int firstTextIndex)
|
|||
// 2 - in LTR mode, the previous word should be RTL (i.e. reversed)
|
||||
for (int i = startIndex; i <= endIndex; i++)
|
||||
{
|
||||
if (isNeutral(this->elements_[i]->getText()) &&
|
||||
auto &element = this->elements_[i];
|
||||
|
||||
const auto neutral = isNeutral(element->getText());
|
||||
const auto neutralOrUsername =
|
||||
neutral ||
|
||||
element->getFlags().hasAny({MessageElementFlag::BoldUsername,
|
||||
MessageElementFlag::NonBoldUsername});
|
||||
|
||||
if (neutral &&
|
||||
((this->first == FirstWord::RTL && !this->wasPrevReversed_) ||
|
||||
(this->first == FirstWord::LTR && this->wasPrevReversed_)))
|
||||
{
|
||||
this->elements_[i]->reversedNeutral = true;
|
||||
element->reversedNeutral = true;
|
||||
}
|
||||
if (((this->elements_[i]->getText().isRightToLeft() !=
|
||||
if (((element->getText().isRightToLeft() !=
|
||||
(this->first == FirstWord::RTL)) &&
|
||||
!isNeutral(this->elements_[i]->getText())) ||
|
||||
(isNeutral(this->elements_[i]->getText()) &&
|
||||
this->wasPrevReversed_))
|
||||
!neutralOrUsername) ||
|
||||
(neutralOrUsername && this->wasPrevReversed_))
|
||||
{
|
||||
swappedSequence.push(i);
|
||||
this->wasPrevReversed_ = true;
|
||||
|
|
Loading…
Reference in a new issue