diff --git a/src/document/html/parser/forms.c b/src/document/html/parser/forms.c index 5dd5e0180..d8558f996 100644 --- a/src/document/html/parser/forms.c +++ b/src/document/html/parser/forms.c @@ -494,10 +494,10 @@ end_parse: fc->labels = labels; menu_labels(fc->menu, "", labels); - put_chrs(html_context, "[", 1); html_stack_dup(html_context, ELEMENT_KILLABLE); format.form = fc; format.style.attr |= AT_BOLD; + put_chrs(html_context, "[ ", 7); max_width = 0; for (i = 0; i < order; i++) { @@ -514,8 +514,8 @@ end_parse: for (i = 0; i < max_width; i++) put_chrs(html_context, "_", 1); + put_chrs(html_context, " ]", 7); pop_html_element(html_context); - put_chrs(html_context, "]", 1); html_context->special_f(html_context, SP_CONTROL, fc); } diff --git a/src/viewer/text/form.c b/src/viewer/text/form.c index 92ef20ea9..4cdc38b13 100644 --- a/src/viewer/text/form.c +++ b/src/viewer/text/form.c @@ -589,28 +589,38 @@ drew_char: else /* XXX: when can this happen? --pasky */ s = ""; -#ifdef CONFIG_UTF8 - if (term->utf8_cp) goto utf8_select; -#endif /* CONFIG_UTF8 */ + + /* insert preceding '[_' */ + i = 0; + x = link->points[i].x + dx; + y = link->points[i].y + dy; + if (is_in_box(box, x, y)) + draw_char_data(term, x, y, '['); + i++; + x = link->points[i].x + dx; + y = link->points[i].y + dy; + if (is_in_box(box, x, y)) + draw_char_data(term, x, y, '_'); + i++; + +#ifndef CONFIG_UTF8 len = s ? strlen(s) : 0; - for (i = 0; i < link->npoints; i++) { + for (; i < link->npoints-2; i++) { x = link->points[i].x + dx; y = link->points[i].y + dy; if (is_in_box(box, x, y)) - draw_char_data(term, x, y, i < len ? s[i] : '_'); + draw_char_data(term, x, y, i-2 < len ? s[i] : '_'); } - break; -#ifdef CONFIG_UTF8 -utf8_select: +#else text = s; end = strchr((const char *)s, '\0'); len = utf8_ptr2cells(text, end); - for (i = 0; i < link->npoints; i++) { + for (; i < link->npoints-2; i++) { x = link->points[i].x + dx; y = link->points[i].y + dy; if (is_in_box(box, x, y)) { unicode_val_T data; - if (i < len) { + if (i-2 < len) { int cell; data = utf8_to_unicode(&s, end); @@ -628,8 +638,18 @@ utf8_select: draw_char_data(term, x, y, data); } } - break; #endif /* CONFIG_UTF8 */ + /* insert trailing ' ]'. */ + x = link->points[i].x + dx; + y = link->points[i].y + dy; + if (is_in_box(box, x, y)) + draw_char_data(term, x, y, '_'); + i++; + x = link->points[i].x + dx; + y = link->points[i].y + dy; + if (is_in_box(box, x, y)) + draw_char_data(term, x, y, ']'); + break; case FC_SUBMIT: case FC_IMAGE: case FC_RESET: diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index b91d8fc43..0dd9a1bc4 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -123,6 +123,7 @@ get_link_cursor_offset(struct document_view *doc_view, struct link *link) case LINK_CHECKBOX: return 1; + case LINK_SELECT: case LINK_BUTTON: return 2; @@ -156,7 +157,6 @@ get_link_cursor_offset(struct document_view *doc_view, struct link *link) case LINK_HYPERTEXT: case LINK_MAP: - case LINK_SELECT: return 0; }