Hi Adam,
So perhaps reassign the bug to libxm4.
No, according to my analysis of the code, this is not excatly what
it does, and it seems to me that the code is inconsistent (so this
is clearly unintended). The code is
if (tf->text.max_char_size == 1) { /* data is char* and one-byte per char */
if (isspace((unsigned char)TextF_Value(tf)[pos1]) ||
isspace((unsigned char)TextF_Value(tf)[pos2])) return True;
} else {
size_pos1 = wctomb(s1, TextF_WcValue(tf)[pos1]);
size_pos2 = wctomb(s2, TextF_WcValue(tf)[pos2]);
if (size_pos1 == 1 && (size_pos2 != 1 || isspace((unsigned char)*s1)))
return True;
if (size_pos2 == 1 && (size_pos1 != 1 || isspace((unsigned char)*s2)))
return True;
}
return False;
For text with multibyte characters, this is the "else" case.
So, for "dé", 'é' is regarded as a space due to size_pos2 != 1.
Note that if one has 2 ASCII spaces, this also returns True.
But with "éé", one would have size_pos1 > 1 and size_pos2 > 1,
so that neither "if" is satisfied, and this returns False, i.e.
in such a case, 'é' is regarded as a non-space character.
In short, a non-ASCII letter (like 'é') is regarded as a space
only if the other adjacent character is an ASCII character.
This does not make sense!
I think that either iswspace() should be used or non-ASCII characters
should consistently be regarded as non-space characters (this is not
always true, but probably the best behavior if iswspace() isn't used).
In the latter case, "size_pos2 != 1 ||" and "size_pos1 != 1 ||" would
just have to be removed.