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

Make select forms look more like other forms.

Insert "[_" and "_]" as part of the form link, and
include it as part of the link.
This commit is contained in:
Yozo Hida 2009-05-01 15:39:30 -04:00 committed by أحمد المحمودي (Ahmed El-Mahmoudy)
parent d8e749c0f4
commit 7e58737619
3 changed files with 34 additions and 14 deletions

View File

@ -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, "&nbsp;]", 7);
pop_html_element(html_context);
put_chrs(html_context, "]", 1);
html_context->special_f(html_context, SP_CONTROL, fc);
}

View File

@ -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 */
len = s ? strlen(s) : 0;
for (i = 0; i < link->npoints; i++) {
/* 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 < len ? s[i] : '_');
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 < 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-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:

View File

@ -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;
}