The code that looks whether neighbor block has a different direction
should look to the left or to the right depending on the direction of
the current block.
Fixes part of bug #10569
(cherry picked from commit
e3d252cd6256b32745b93c0cb0fd5170f448f91c)
* how boundary helps here.
*/
else if (pos == cit->endpos
- && cit + 1 != row.end()
- && cit->isRTL() != (cit + 1)->isRTL())
+ && ((!cit->isRTL() && cit + 1 != row.end()
+ && (cit + 1)->isRTL())
+ || (cit->isRTL() && cit != row.begin()
+ && !(cit - 1)->isRTL())))
boundary = true;
}