Fix bug in Bidi mapping visual to logical positions
There are three positions for each character:
- Logical (where it is in the text, extended characters count as one)
- Visual (where it is on the screen)
- Line (where it is in the text, extended characters are expanded).
In TerminalDisplay::bidiMap, the calculation of visual to line map, used logical instead of visual in one place. This causes using an uninitialized memory as an index to an array, as well as other issues.
When no extended characters are used, line and logical are the same. When no bidi characters (Arabic or Hebrew) are used, visual and logical are the same.