chars: short-circuit determining the width of characters under U+0300
The combining characters (that are zero-width) start at U+0300. After that it's pretty much chaos, width-wise. The mbwidth() function is not called for control characters (whose representation takes up two columns), as they are handled separately. The calls of mbwidth() that *can* happen with a control character as argument are only to determine whether the character is zero-width, and then it doesn't matter whether the exact width is 1 or 2.
Этот коммит содержится в:
родитель
0693d6974a
Коммит
10b99d8ac0
@ -179,8 +179,8 @@ char control_mbrep(const char *c, bool isdata)
|
||||
/* Return the width in columns of the given (multibyte) character. */
|
||||
int mbwidth(const char *c)
|
||||
{
|
||||
/* Ask for the width only when the character isn't plain ASCII. */
|
||||
if ((unsigned char)*c > 0xC1) {
|
||||
/* Only characters beyond U+02FF can be other than one column wide. */
|
||||
if ((unsigned char)*c > 0xCB) {
|
||||
wchar_t wc;
|
||||
int width;
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user