1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-04 04:52:47 -05:00

Make bidi work with wide characters.

Previously, any double-width character would break the bidi algorithm,
because of the quirk of data representation in which we store UCSWIDE
(0xDFFF) in the right-hand termchar overlapped by the character.
UCSWIDE has bidirectional character class L according to minibidi's
getType(), so it disrupted the algorithm.

Now we remove UCSWIDE from the input line before passing it to
do_bidi(), replacing it with an 'nchars' field in the bidi_char
structure indicating single or double width, and put the UCSWIDEs back
afterwards once do_bidi returns.
This commit is contained in:
Simon Tatham
2019-02-25 20:51:17 +00:00
parent 8edfc767a3
commit fec93d5e05
2 changed files with 30 additions and 12 deletions

View File

@ -1899,7 +1899,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
*/
typedef struct bidi_char {
unsigned int origwc, wc;
unsigned short index;
unsigned short index, nchars;
} bidi_char;
int do_bidi(bidi_char *line, int count);
int do_shape(bidi_char *line, bidi_char *to, int count);