Fixes for EastAsianWidth wide chars on RTL context
While real CJK wide characters are usually LTR, emoji, emoji-like characters, and some others (e.g. Yi Radicals) can have the properties 'East_Asian_Width: Wide' and 'Bidi_Class: Other_Neutral', which on a RTL context makes them inherit the RTL behavior. This would cause trouble when e.g. inserting wide emoji in RTL text, such as: ک⚡ ں which is the result of: printf '\u6a9\u26a1\u6ba\n' The position of the emoji would be incorrect. In LTR text it's correct because wide chars are followed by a dummy char, so the next real character gets the correct position. In RTL text we'd need to advance left one additional time _before_ writing this char. This positioning glitch is also seen with the cursor. Cursoring over the second character with a block cursor would create a wide cursor stretching the right half of the second character and the first character (which would potentially be hidden, depending on the cursor color settings). An underline cursor would have a similar issue, modulo the hidden char part. Bidi_Mirrored wide characters (e.g. U+2329) will probably need future consideration, if we ever get around to supporting them.
Please register or sign in to comment