3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

client: better support utf-8 for table rows

The utf-8 bytes were being counted as normal ascii so the
width maximum was not being increased to include
non-printable bytes like it is for color escape sequences.
This lead to the row not printing enough characters which
effected the text further down the line.

Fix this by increasing 'max' when non-codepoint utf-8
characters are found.
This commit is contained in:
James Prestwood 2022-10-07 12:59:37 -07:00 committed by Denis Kenzior
parent 0c8f06441e
commit f9b7e32c2d

View File

@ -410,7 +410,9 @@ static char* next_line(char *s, unsigned int *max, char **color_out)
/* color escape won't count for column width */
*max += color_end(s + i);
last_color = i;
}
/* Add width for non-codepoint UTF-8 bytes */
} else if (((uint8_t)s[i] >> 6) == 2)
*max += 1;
}
/* Reached the end of the string within the column bounds */