BiDi, shaping: offset Arabic ligatures by half cell
There are certain mandatory ligatures in Arabic, e.g. LAM U+0644 (on the right) + ALEF U+0627 (on the left) needs to become a single symbol (U+FEFB or U+FEFC in the legacy presentation form characters).
FriBidi replaces the first (right) character with ZWNBSP U+FEFF and the second (left) character with the desired presentation form. As a result, they show up with a large gap on their right side.
We should check what Arabic monospace fonts do, e.g. whether there's any font where this glyph is double wide. Unfortunately it's hopeless to fix this issue in the emulation layer and make them occupy 1 cell only, the problem has to be mitigated on the display layer.
If all the Arabic monospace fonts have narrow glyphs for these ligatures, we could try shifting them by half a cell to the right, to at least distribute that gap more evenly.
A proof of concept patch for that is attached here (which does not address when the rectangle cursor is over one of its cells).