1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Bug fix: hidden UTF-8 characters before end of input box

Bug fix: when UTF-8 characters are entered into input box they are hidden
before end of input box.
This commit is contained in:
Pavol Babincak 2006-01-31 01:26:27 +01:00 committed by Jonas Fonseca
parent 0bacd766e2
commit 585d69355a

View File

@ -298,13 +298,20 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
color = get_bfu_color(term, "dialog.field-text");
if (color) {
unsigned char *text = widget_data->cdata + widget_data->info.field.vpos;
int len = strlen(text);
int w = int_min(len, widget_data->box.width);
unsigned char *text2 = text;
int x, l, len, w;
len = (term->utf8) ? strlen_utf8(&text2) : strlen(text);
w = int_min(len, widget_data->box.width);
if (!hide) {
if (term->utf8) {
for (l = 0, x = 0; x < w; x++)
l += utf8charlen(text+l);
w = l;
}
draw_text(term, widget_data->box.x, widget_data->box.y,
widget_data->cdata + widget_data->info.field.vpos, w,
0, color);
text, w, 0, color);
} else {
struct box box;