1
0
Fork 0

[select] off by two. Refs #88

Also changed a bit utf8_to_unicode.
This commit is contained in:
Witold Filipczyk 2021-01-17 21:56:40 +01:00
parent 7b749dccb4
commit dfbd75c958
3 changed files with 13 additions and 5 deletions

View File

@ -657,13 +657,13 @@ unicode_fold_label_case(unicode_val_T c)
NONSTATIC_INLINE unicode_val_T
utf8_to_unicode(char **string, const char *end)
{
char *str = *string;
unsigned char *str = (unsigned char *)*string;
unicode_val_T u;
int length;
length = utf8char_len_tab[(unsigned char)str[0]];
length = utf8char_len_tab[str[0]];
if (str + length > end) {
if (str + length > (const unsigned char *)end) {
return UCS_NO_CHAR;
}
@ -734,7 +734,7 @@ invalid_utf8:
INTERNAL("utf8char_len_tab out of range");
goto invalid_utf8;
}
*string = str + length;
*string = (char *)(str + length);
return u;
}

View File

@ -625,7 +625,7 @@ drew_char:
data = utf8_to_unicode(&s, end);
cell = unicode_to_cell(data);
if (i + 1 < len && cell == 2) {
if (i - 1 < len && cell == 2) {
draw_char_data(term, x++, y, data);
data = UCS_NO_CHAR;

8
test/select.html Normal file
View File

@ -0,0 +1,8 @@
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<select> <option selected="selected">简体中文</option> </select>
</body>
</html>