1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-27 01:25:34 +00:00

[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 3fc5c204af
commit d5e19583f5
3 changed files with 11 additions and 3 deletions

View File

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

View File

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