mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Rename CONFIG_UTF_8 to CONFIG_UTF8.
The configure script no longer recognizes "CONFIG_UTF_8=yes" lines in custom features.conf files. They will have to be changed to "CONFIG_UTF8=yes". This incompatibility was deemed acceptable because no released version of ELinks supports CONFIG_UTF_8. The --enable-utf-8 option was not renamed.
This commit is contained in:
parent
e8462980e5
commit
92cb452a9e
@ -161,7 +161,7 @@ CONFIG_SSL = @CONFIG_SSL@
|
||||
CONFIG_SYSMOUSE = @CONFIG_SYSMOUSE@
|
||||
CONFIG_TRUE_COLOR = @CONFIG_TRUE_COLOR@
|
||||
CONFIG_URI_REWRITE = @CONFIG_URI_REWRITE@
|
||||
CONFIG_UTF_8 = @CONFIG_UTF_8@
|
||||
CONFIG_UTF8 = @CONFIG_UTF8@
|
||||
CONFIG_XBEL_BOOKMARKS = @CONFIG_XBEL_BOOKMARKS@
|
||||
CONFIG_XMLTO = @CONFIG_XMLTO@
|
||||
CONFIG_GSSAPI = @CONFIG_GSSAPI@
|
||||
|
@ -1281,7 +1281,7 @@ EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
|
||||
EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
|
||||
[ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
|
||||
|
||||
EL_ARG_ENABLE(CONFIG_UTF_8, utf-8, [UTF-8],
|
||||
EL_ARG_ENABLE(CONFIG_UTF8, utf-8, [UTF-8],
|
||||
[ --enable-utf-8 enable UTF-8 support])
|
||||
|
||||
|
||||
|
@ -626,7 +626,7 @@ CONFIG_SMALL=no
|
||||
#
|
||||
# Default: disabled
|
||||
|
||||
CONFIG_UTF_8=no
|
||||
CONFIG_UTF8=no
|
||||
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static void
|
||||
buttons_width(struct widget_data *widget_data, int n,
|
||||
int *minwidth, int *maxwidth, int utf8)
|
||||
@ -85,25 +85,25 @@ buttons_width(struct widget_data *widget_data, int n,
|
||||
static void
|
||||
buttons_width(struct widget_data *widget_data, int n,
|
||||
int *minwidth, int *maxwidth)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
int maxw = -BUTTON_HSPACING;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int button_lr_len = utf8_ptr2cells(BUTTON_LEFT, NULL)
|
||||
+ utf8_ptr2cells(BUTTON_RIGHT, NULL);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
assert(n > 0);
|
||||
if_assert_failed return;
|
||||
|
||||
while (n--) {
|
||||
int minw;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8)
|
||||
minw = utf8_ptr2cells((widget_data++)->widget->text, NULL)
|
||||
+ BUTTON_HSPACING + button_lr_len;
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
minw = (widget_data++)->widget->info.button.textlen
|
||||
+ BUTTON_HSPACING + BUTTON_LR_LEN;
|
||||
|
||||
@ -128,41 +128,41 @@ dlg_format_buttons(struct terminal *term,
|
||||
|
||||
while (i2 < n) {
|
||||
mw = 0;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
buttons_width(widget_data1, i2 - i1 + 1, NULL, &mw,
|
||||
term->utf8);
|
||||
#else
|
||||
buttons_width(widget_data1, i2 - i1 + 1, NULL, &mw);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
if (mw <= w) i2++;
|
||||
else break;
|
||||
}
|
||||
|
||||
mw = 0;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
buttons_width(widget_data1, i2 - i1, NULL, &mw, term->utf8);
|
||||
#else
|
||||
buttons_width(widget_data1, i2 - i1, NULL, &mw);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
if (rw) int_bounds(rw, mw, w);
|
||||
|
||||
if (!format_only) {
|
||||
int i;
|
||||
int p = x + (align == ALIGN_CENTER ? (w - mw) / 2 : 0);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int button_lr_len = utf8_ptr2cells(BUTTON_LEFT, NULL)
|
||||
+ utf8_ptr2cells(BUTTON_RIGHT, NULL);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
for (i = i1; i < i2; i++) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
set_box(&widget_data[i].box,
|
||||
p, *y,
|
||||
utf8_ptr2cells(widget_data[i].widget->text, NULL)
|
||||
+ button_lr_len, BUTTON_HEIGHT);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
set_box(&widget_data[i].box,
|
||||
p, *y,
|
||||
widget_data[i].widget->info.button.textlen
|
||||
@ -195,7 +195,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
}
|
||||
if (!color || !shortcut_color) return EVENT_PROCESSED;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
int button_left_len = utf8_ptr2cells(BUTTON_LEFT, NULL);
|
||||
int button_right_len = utf8_ptr2cells(BUTTON_RIGHT, NULL);
|
||||
@ -205,7 +205,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
(button_left_len + button_right_len);
|
||||
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
x = pos->x + BUTTON_LEFT_LEN;
|
||||
len = widget_data->box.width - BUTTON_LR_LEN;
|
||||
@ -221,7 +221,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
attr = get_opt_bool("ui.dialogs.underline_button_shortcuts")
|
||||
? SCREEN_ATTR_UNDERLINE : 0;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
if (hk_pos >= 0) {
|
||||
int hk_bytes = utf8charlen(&text[hk_pos+1]);
|
||||
@ -266,7 +266,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
0, color);
|
||||
}
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
if (hk_pos >= 0) {
|
||||
int right = widget_data->widget->info.button.truetextlen - hk_pos - 1;
|
||||
|
||||
@ -285,7 +285,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
draw_text(term, x + 1, pos->y, &text[1], len - 1, 0, color);
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
int text_cells = utf8_ptr2cells(widget_data->widget->text, NULL);
|
||||
int hk = (widget_data->widget->info.button.hotkey_pos >= 0);
|
||||
@ -293,7 +293,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
draw_text(term, x + text_cells - hk, pos->y,
|
||||
BUTTON_RIGHT, BUTTON_RIGHT_LEN, 0, color);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
draw_text(term, x + len, pos->y, BUTTON_RIGHT,
|
||||
BUTTON_RIGHT_LEN, 0, color);
|
||||
if (sel) {
|
||||
|
@ -101,19 +101,19 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
|
||||
int titlecells = titlelen;
|
||||
int x, y;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
titlecells = utf8_ptr2cells(title,
|
||||
&title[titlelen]);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
titlecells = int_min(box.width - 2, titlecells);
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
titlelen = utf8_cells2bytes(title, titlecells,
|
||||
NULL);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
x = (box.width - titlecells) / 2 + box.x;
|
||||
y = box.y - 1;
|
||||
@ -286,7 +286,7 @@ static void
|
||||
select_button_by_key(struct dialog_data *dlg_data)
|
||||
{
|
||||
term_event_char_T key;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int codepage;
|
||||
#endif
|
||||
|
||||
@ -295,7 +295,7 @@ select_button_by_key(struct dialog_data *dlg_data)
|
||||
|
||||
if (!check_kbd_label_key(ev)) return;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
key = unicode_fold_label_case(get_kbd_key(ev));
|
||||
codepage = get_opt_codepage_tree(dlg_data->win->term->spec, "charset");
|
||||
#else
|
||||
@ -319,7 +319,7 @@ select_button_by_key(struct dialog_data *dlg_data)
|
||||
else
|
||||
hk_ptr = widget_data->widget->text;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
hk_char = cp_to_unicode(codepage, &hk_ptr,
|
||||
strchr(hk_ptr, '\0'));
|
||||
hk_char = unicode_fold_label_case(hk_char);
|
||||
@ -611,11 +611,11 @@ generic_dialog_layouter(struct dialog_data *dlg_data)
|
||||
int height = dialog_max_height(term);
|
||||
int x = 0, y, rw;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
rw = int_min(w, utf8_ptr2cells(dlg_data->dlg->title, NULL));
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
rw = int_min(w, strlen(dlg_data->dlg->title));
|
||||
y = dlg_data->dlg->layout.padding_top ? 0 : -1;
|
||||
|
||||
@ -656,15 +656,15 @@ draw_dialog(struct dialog_data *dlg_data, int width, int height)
|
||||
/* Draw shadow */
|
||||
draw_shadow(term, &dlg_data->box,
|
||||
get_bfu_color(term, "dialog.shadow"), 2, 1);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
fix_dwchar_around_box(term, &dlg_data->box, 0, 2, 1);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
else if(term->utf8)
|
||||
fix_dwchar_around_box(term, &dlg_data->box, 0, 0, 0);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -39,14 +39,14 @@ dlg_format_group(struct terminal *term,
|
||||
int label_length;
|
||||
int label_padding;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
if (text && *text)
|
||||
label_length = utf8_ptr2cells(text, NULL);
|
||||
else
|
||||
label_length = 0;
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
label_length = (text && *text) ? strlen(text) : 0;
|
||||
|
||||
label_padding = (label_length > 0);
|
||||
@ -54,12 +54,12 @@ dlg_format_group(struct terminal *term,
|
||||
if (widget_data->widget->type == WIDGET_CHECKBOX) {
|
||||
width = CHECKBOX_LEN;
|
||||
} else if (widget_is_textfield(widget_data)) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
width = utf8_ptr2cells(widget_data->widget->data,
|
||||
NULL);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
width = widget_data->widget->datalen;
|
||||
} else {
|
||||
/* TODO: handle all widget types. */
|
||||
@ -81,7 +81,7 @@ dlg_format_group(struct terminal *term,
|
||||
if (widget_data->widget->type == WIDGET_CHECKBOX) {
|
||||
/* Draw text at right of checkbox. */
|
||||
if (label_length) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
int lb = utf8_cells2bytes(
|
||||
text,
|
||||
@ -92,7 +92,7 @@ dlg_format_group(struct terminal *term,
|
||||
*y, text, lb, 0,
|
||||
color);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
draw_text(term, xpos + width
|
||||
+ label_padding,
|
||||
@ -107,7 +107,7 @@ dlg_format_group(struct terminal *term,
|
||||
} else if (widget_is_textfield(widget_data)) {
|
||||
/* Draw label at left of widget. */
|
||||
if (label_length) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
int lb = utf8_cells2bytes(
|
||||
text,
|
||||
@ -116,7 +116,7 @@ dlg_format_group(struct terminal *term,
|
||||
draw_text(term, xpos, *y,
|
||||
text, lb, 0, color);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
draw_text(term, xpos, *y,
|
||||
text, label_length,
|
||||
@ -148,11 +148,11 @@ group_layouter(struct dialog_data *dlg_data)
|
||||
int y = 0;
|
||||
int n = dlg_data->number_of_widgets - 2;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
rw = int_min(w, utf8_ptr2cells(dlg_data->dlg->title, NULL));
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
rw = int_min(w, strlen(dlg_data->dlg->title));
|
||||
|
||||
dlg_format_group(term, dlg_data->widgets_data, n,
|
||||
|
@ -125,7 +125,7 @@ static int
|
||||
check_hotkeys_common(struct menu *menu, term_event_char_T hotkey, struct terminal *term,
|
||||
int check_mode)
|
||||
{
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unicode_val_T key = unicode_fold_label_case(hotkey);
|
||||
int codepage = get_opt_codepage_tree(term->spec, "charset");
|
||||
#else
|
||||
@ -143,7 +143,7 @@ check_hotkeys_common(struct menu *menu, term_event_char_T hotkey, struct termina
|
||||
do {
|
||||
struct menu_item *item;
|
||||
unsigned char *text;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unicode_val_T items_hotkey;
|
||||
#endif
|
||||
int found;
|
||||
@ -176,7 +176,7 @@ check_hotkeys_common(struct menu *menu, term_event_char_T hotkey, struct termina
|
||||
}
|
||||
|
||||
/* Compare @key to the character to which @text points. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
items_hotkey = cp_to_unicode(codepage, &text,
|
||||
strchr(text, '\0'));
|
||||
found = (unicode_fold_label_case(items_hotkey) == key);
|
||||
|
@ -266,11 +266,11 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
|
||||
struct terminal *term = dlg_data->win->term;
|
||||
struct color_pair *color;
|
||||
int sel = is_selected_widget(dlg_data, widget_data);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int len = 0, left = 0;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
unsigned char *t = widget_data->cdata;
|
||||
int p = widget_data->info.field.cpos;
|
||||
@ -280,7 +280,7 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
|
||||
int_lower_bound(&left, 0);
|
||||
widget_data->info.field.vpos = utf8_cells2bytes(t, left, NULL);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
int_bounds(&widget_data->info.field.vpos,
|
||||
widget_data->info.field.cpos - widget_data->box.width + 1,
|
||||
@ -297,21 +297,21 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
|
||||
unsigned char *text = widget_data->cdata + widget_data->info.field.vpos;
|
||||
int len, w;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8 && !hide)
|
||||
len = utf8_ptr2cells(text, NULL);
|
||||
else if (term->utf8)
|
||||
len = utf8_ptr2chars(text, NULL);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
len = strlen(text);
|
||||
w = int_min(len, widget_data->box.width);
|
||||
|
||||
if (!hide) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
w = utf8_cells2bytes(text, w, NULL);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
draw_text(term, widget_data->box.x, widget_data->box.y,
|
||||
text, w, 0, color);
|
||||
} else {
|
||||
@ -327,11 +327,11 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
|
||||
if (sel) {
|
||||
int x;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
x = widget_data->box.x + len - left;
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
x = widget_data->box.x + widget_data->info.field.cpos - widget_data->info.field.vpos;
|
||||
|
||||
set_cursor(term, x, widget_data->box.y, 0);
|
||||
@ -473,7 +473,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
|
||||
case ACT_EDIT_RIGHT:
|
||||
if (widget_data->info.field.cpos < strlen(widget_data->cdata)) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
unsigned char *next = widget_data->cdata + widget_data->info.field.cpos;
|
||||
unsigned char *end = strchr(next, '\0');
|
||||
@ -481,7 +481,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
utf8_to_unicode(&next, end);
|
||||
widget_data->info.field.cpos = (int)(next - widget_data->cdata);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
widget_data->info.field.cpos++;
|
||||
}
|
||||
@ -491,7 +491,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
case ACT_EDIT_LEFT:
|
||||
if (widget_data->info.field.cpos > 0)
|
||||
widget_data->info.field.cpos--;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (widget_data->info.field.cpos && term->utf8) {
|
||||
unsigned char *t = widget_data->cdata;
|
||||
unsigned char *t2 = t;
|
||||
@ -504,7 +504,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
widget_data->info.field.cpos = (int)(t2 - t);
|
||||
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
goto display_field;
|
||||
|
||||
case ACT_EDIT_HOME:
|
||||
@ -516,7 +516,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
goto display_field;
|
||||
|
||||
case ACT_EDIT_BACKSPACE:
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (widget_data->info.field.cpos && term->utf8) {
|
||||
/* XXX: stolen from src/viewer/text/form.c */
|
||||
/* FIXME: This isn't nice. We remove last byte
|
||||
@ -543,7 +543,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
}
|
||||
goto display_field;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
if (widget_data->info.field.cpos) {
|
||||
memmove(widget_data->cdata + widget_data->info.field.cpos - 1,
|
||||
widget_data->cdata + widget_data->info.field.cpos,
|
||||
@ -558,7 +558,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
|
||||
if (widget_data->info.field.cpos >= cdata_len) goto display_field;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
unsigned char *end = widget_data->cdata + cdata_len;
|
||||
unsigned char *text = widget_data->cdata + widget_data->info.field.cpos;
|
||||
@ -571,7 +571,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
}
|
||||
goto display_field;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
memmove(widget_data->cdata + widget_data->info.field.cpos,
|
||||
widget_data->cdata + widget_data->info.field.cpos + 1,
|
||||
cdata_len - widget_data->info.field.cpos + 1);
|
||||
@ -680,12 +680,12 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
if (check_kbd_textinput_key(ev)) {
|
||||
unsigned char *text = widget_data->cdata;
|
||||
int textlen = strlen(text);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
const unsigned char *ins = encode_utf8(get_kbd_key(ev));
|
||||
int inslen = utf8charlen(ins);
|
||||
#else /* !CONFIG_UTF_8 */
|
||||
#else /* !CONFIG_UTF8 */
|
||||
const int inslen = 1;
|
||||
#endif /* !CONFIG_UTF_8 */
|
||||
#endif /* !CONFIG_UTF8 */
|
||||
|
||||
if (textlen >= widget_data->widget->datalen - inslen)
|
||||
goto display_field;
|
||||
@ -695,11 +695,11 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
text += widget_data->info.field.cpos;
|
||||
|
||||
memmove(text + inslen, text, textlen + 1);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
memcpy(text, ins, inslen);
|
||||
#else /* !CONFIG_UTF_8 */
|
||||
#else /* !CONFIG_UTF8 */
|
||||
*text = get_kbd_key(ev);
|
||||
#endif /* !CONFIG_UTF_8 */
|
||||
#endif /* !CONFIG_UTF8 */
|
||||
widget_data->info.field.cpos += inslen;
|
||||
goto display_field;
|
||||
}
|
||||
|
@ -462,11 +462,11 @@ display_listbox_item(struct listbox_item *item, void *data_, int *offset)
|
||||
|
||||
len = strlen(text);
|
||||
int_upper_bound(&len, int_max(0, data->widget_data->box.width - depth * 5));
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (data->term->utf8)
|
||||
len_bytes = utf8_cells2bytes(text, len, NULL);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
len_bytes = len;
|
||||
|
||||
draw_text(data->term, x, y, text, len_bytes, 0, text_color);
|
||||
|
@ -200,12 +200,12 @@ get_menuitem_text_width(struct terminal *term, struct menu_item *mi)
|
||||
|
||||
if (!text[0]) return 0;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
return L_TEXT_SPACE + utf8_ptr2cells(text, NULL)
|
||||
- !!mi->hotkey_pos + R_TEXT_SPACE;
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
return L_TEXT_SPACE + strlen(text)
|
||||
- !!mi->hotkey_pos + R_TEXT_SPACE;
|
||||
}
|
||||
@ -382,13 +382,13 @@ draw_menu_left_text(struct terminal *term, unsigned char *text, int len,
|
||||
if (len < 0) len = strlen(text);
|
||||
if (!len) return;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
max_len = utf8_cells2bytes(text, w, NULL);
|
||||
if (max_len <= 0)
|
||||
return;
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
max_len = w;
|
||||
|
||||
if (len > max_len) len = max_len;
|
||||
@ -410,7 +410,7 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text,
|
||||
int xbase = x + L_TEXT_SPACE;
|
||||
int w = width - (L_TEXT_SPACE + R_TEXT_SPACE);
|
||||
int hk_state = 0;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unsigned char *text2, *end;
|
||||
#endif
|
||||
|
||||
@ -430,9 +430,9 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text,
|
||||
hk_color_sel = tmp;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) goto utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
for (x = 0; x - !!hk_state < w && (c = text[x]); x++) {
|
||||
if (!hk_state && x == hotkey_pos - 1) {
|
||||
@ -454,7 +454,7 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text,
|
||||
}
|
||||
return;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
utf8:
|
||||
end = strchr(text, '\0');
|
||||
text2 = text;
|
||||
@ -517,7 +517,7 @@ utf8:
|
||||
}
|
||||
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
|
||||
static inline void
|
||||
@ -560,15 +560,15 @@ display_menu(struct terminal *term, struct menu *menu)
|
||||
/* Draw shadow */
|
||||
draw_shadow(term, &menu->box,
|
||||
get_bfu_color(term, "dialog.shadow"), 2, 1);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
fix_dwchar_around_box(term, &box, 1, 2, 1);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
else if(term->utf8)
|
||||
fix_dwchar_around_box(term, &box, 1, 0, 0);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
menu_height = box.height;
|
||||
box.height = 1;
|
||||
@ -1114,23 +1114,23 @@ display_mainmenu(struct terminal *term, struct menu *menu)
|
||||
text = _(text, term);
|
||||
|
||||
textlen = strlen(text) - !!l;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
screencnt = utf8_ptr2cells(text, NULL) - !!l;
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
screencnt = textlen;
|
||||
|
||||
if (selected) {
|
||||
color = selected_color;
|
||||
box.x = p;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
box.width = L_MAINTEXT_SPACE + L_TEXT_SPACE
|
||||
+ screencnt
|
||||
+ R_TEXT_SPACE + R_MAINTEXT_SPACE;
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
box.width = L_MAINTEXT_SPACE + L_TEXT_SPACE
|
||||
+ textlen
|
||||
+ R_TEXT_SPACE + R_MAINTEXT_SPACE;
|
||||
@ -1163,7 +1163,7 @@ display_mainmenu(struct terminal *term, struct menu *menu)
|
||||
menu->last = i - 1;
|
||||
int_lower_bound(&menu->last, menu->first);
|
||||
if (menu->last < menu->size - 1) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
struct screen_char *schar;
|
||||
|
||||
|
@ -36,13 +36,13 @@ add_dlg_text(struct dialog *dlg, unsigned char *text,
|
||||
}
|
||||
|
||||
/* Returns length of substring (from start of @text) before a split. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static inline int
|
||||
split_line(unsigned char *text, int max_width, int *cells, int utf8)
|
||||
#else
|
||||
static inline int
|
||||
split_line(unsigned char *text, int max_width, int *cells)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
unsigned char *split = text;
|
||||
int cells_save = *cells;
|
||||
@ -52,7 +52,7 @@ split_line(unsigned char *text, int max_width, int *cells)
|
||||
while (*split && *split != '\n') {
|
||||
unsigned char *next_split;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8) {
|
||||
unsigned char *next_char_begin = split
|
||||
+ utf8charlen(split);
|
||||
@ -74,7 +74,7 @@ split_line(unsigned char *text, int max_width, int *cells)
|
||||
next_char_begin += utf8charlen(next_split);
|
||||
}
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
next_split = split + 1;
|
||||
|
||||
@ -88,7 +88,7 @@ split_line(unsigned char *text, int max_width, int *cells)
|
||||
* meaning there's no splittable substring under
|
||||
* requested width. */
|
||||
if (split == text) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8) {
|
||||
int m_bytes = utf8_cells2bytes(text,
|
||||
max_width,
|
||||
@ -97,7 +97,7 @@ split_line(unsigned char *text, int max_width, int *cells)
|
||||
cells_save = utf8_ptr2cells(text,
|
||||
split);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
split = &text[max_width];
|
||||
cells_save = max_width;
|
||||
@ -106,9 +106,9 @@ split_line(unsigned char *text, int max_width, int *cells)
|
||||
/* FIXME: Function ispunct won't work correctly
|
||||
* with UTF-8 characters. We need some similar
|
||||
* function for UTF-8 characters. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (!utf8)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
/* Give preference to split on a
|
||||
* punctuation if any. Note that most
|
||||
@ -150,13 +150,13 @@ split_line(unsigned char *text, int max_width, int *cells)
|
||||
#define realloc_lines(x, o, n) mem_align_alloc(x, o, n, LINES_GRANULARITY)
|
||||
|
||||
/* Find the start of each line with the current max width */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static unsigned char **
|
||||
split_lines(struct widget_data *widget_data, int max_width, int utf8)
|
||||
#else
|
||||
static unsigned char **
|
||||
split_lines(struct widget_data *widget_data, int max_width)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
unsigned char *text = widget_data->widget->text;
|
||||
unsigned char **lines = (unsigned char **) widget_data->cdata;
|
||||
@ -175,7 +175,7 @@ split_lines(struct widget_data *widget_data, int max_width)
|
||||
if (isspace(*text)) text++;
|
||||
if (!*text) break;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
width = split_line(text, max_width, &cells, utf8);
|
||||
#else
|
||||
width = split_line(text, max_width, &cells);
|
||||
@ -228,11 +228,11 @@ dlg_format_text_do(struct terminal *term, unsigned char *text,
|
||||
firstline = 0;
|
||||
if (!*text) break;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
line_width = split_line(text, width, &cells, term->utf8);
|
||||
#else
|
||||
line_width = split_line(text, width, &cells);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* split_line() may return 0. */
|
||||
if (line_width < 1) {
|
||||
@ -286,7 +286,7 @@ dlg_format_text(struct terminal *term, struct widget_data *widget_data,
|
||||
|
||||
/* Ensure that the current split is valid but don't
|
||||
* split if we don't have to */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (widget_data->box.width != width
|
||||
&& !split_lines(widget_data, width, term->utf8))
|
||||
return;
|
||||
|
@ -182,10 +182,10 @@ void add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd
|
||||
/* void add_accesskey_to_string(struct string *str, unicode_val_T accesskey); */
|
||||
#define add_accesskey_to_string(str, accesskey) do { \
|
||||
struct term_event_keyboard kbd; \
|
||||
/* FIXME: #ifndef CONFIG_UTF_8, kbd.key is encoded in \
|
||||
/* FIXME: #ifndef CONFIG_UTF8, kbd.key is encoded in \
|
||||
* the charset of the terminal, so accesskey should be \
|
||||
* converted from unicode_val_T to that. \
|
||||
* #ifdef CONFIG_UTF_8, the code is correct. */ \
|
||||
* #ifdef CONFIG_UTF8, the code is correct. */ \
|
||||
kbd.key = accesskey; \
|
||||
/* try_document_key() recognizes only Alt-accesskey \
|
||||
* combos. */ \
|
||||
|
@ -145,11 +145,11 @@ download_dialog_layouter(struct dialog_data *dlg_data)
|
||||
mem_free(msg);
|
||||
return;
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
decode_uri(url);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
decode_uri_for_display(url);
|
||||
url_len = strlen(url);
|
||||
|
||||
@ -302,11 +302,11 @@ get_file_download_text(struct listbox_item *item, struct terminal *term)
|
||||
|
||||
uristring = get_uri_string(file_download->uri, URI_PUBLIC);
|
||||
if (uristring) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
decode_uri(uristring);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
decode_uri_for_display(uristring);
|
||||
}
|
||||
|
||||
|
@ -581,11 +581,11 @@ query_file(struct session *ses, struct uri *uri, void *data,
|
||||
add_mime_filename_to_string(&def, uri);
|
||||
|
||||
/* Remove the %-ugliness for display */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (ses->tab->term->utf8)
|
||||
decode_uri_string(&def);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
decode_uri_string_for_display(&def);
|
||||
|
||||
if (interactive) {
|
||||
|
@ -60,9 +60,9 @@ charset_list(struct terminal *term, void *xxx, void *ses_)
|
||||
|
||||
if (!name) break;
|
||||
|
||||
#ifndef CONFIG_UTF_8
|
||||
#ifndef CONFIG_UTF8
|
||||
if (is_cp_utf8(i)) continue;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
items++;
|
||||
add_to_menu(&mi, name, NULL, ACT_MAIN_NONE,
|
||||
|
@ -419,7 +419,7 @@ display_title_bar(struct session *ses, struct terminal *term)
|
||||
int maxlen = int_max(term->width - 4 - buflen, 0);
|
||||
int titlelen, titlewidth;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
titlewidth = utf8_ptr2cells(document->title, NULL);
|
||||
titlewidth = int_min(titlewidth, maxlen);
|
||||
@ -427,7 +427,7 @@ display_title_bar(struct session *ses, struct terminal *term)
|
||||
titlelen = utf8_cells2bytes(document->title,
|
||||
titlewidth, NULL);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
titlewidth = int_min(strlen(document->title), maxlen);
|
||||
titlelen = titlewidth;
|
||||
@ -444,14 +444,14 @@ display_title_bar(struct session *ses, struct terminal *term)
|
||||
|
||||
if (title.length) {
|
||||
int x;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
x = int_max(term->width - 1
|
||||
- utf8_ptr2cells(title.source,
|
||||
title.source
|
||||
+ title.length), 0);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
x = int_max(term->width - 1 - title.length, 0);
|
||||
|
||||
draw_text(term, x, 0, title.source, title.length, 0,
|
||||
|
@ -118,7 +118,7 @@ struct link {
|
||||
#define get_link_name(link) \
|
||||
(!link_is_form(link) ? (link)->data.name : NULL)
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
struct search {
|
||||
int x, y;
|
||||
signed int n; /* RAM is cheap nowadays */
|
||||
@ -182,7 +182,7 @@ struct document {
|
||||
struct search **slines1;
|
||||
struct search **slines2;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unsigned char buf[7];
|
||||
unsigned char buf_length;
|
||||
#endif
|
||||
|
@ -261,10 +261,10 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
|
||||
struct conv_table *convert = renderer->convert_table;
|
||||
enum convert_string_mode mode = renderer->convert_mode;
|
||||
int x, charlen;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int utf8 = document->options.utf8;
|
||||
unsigned char *end;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
|
||||
assert(renderer && template && string && length);
|
||||
@ -280,9 +280,9 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
|
||||
|
||||
add_search_node(renderer, length);
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
end = string + length;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
for (x = 0, charlen = 1; x < length;x += charlen, renderer->canvas_x++) {
|
||||
unsigned char *text = &string[x];
|
||||
|
||||
@ -307,7 +307,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
|
||||
break;
|
||||
}
|
||||
default:
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8) {
|
||||
unicode_val_T data;
|
||||
charlen = utf8charlen(text);
|
||||
@ -324,7 +324,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
|
||||
}
|
||||
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
template->data = isscreensafe(*text) ? *text:'.';
|
||||
}
|
||||
|
||||
@ -1050,9 +1050,9 @@ render_dom_document(struct cache_entry *cached, struct document *document,
|
||||
init_dom_renderer(&renderer, document, buffer, convert_table);
|
||||
|
||||
document->bgcolor = document->options.default_bg;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
document->options.utf8 = is_cp_utf8(document->options.cp);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
if (document->options.plain)
|
||||
parser_type = SGML_PARSER_STREAM;
|
||||
|
@ -497,12 +497,12 @@ end_parse:
|
||||
max_width = 0;
|
||||
for (i = 0; i < order; i++) {
|
||||
if (!labels[i]) continue;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (html_context->options->utf8)
|
||||
int_lower_bound(&max_width,
|
||||
utf8_ptr2cells(labels[i], NULL));
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
int_lower_bound(&max_width, strlen(labels[i]));
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ realloc_spaces(struct part *part, int length)
|
||||
|
||||
if (!ALIGN_SPACES(&part->spaces, part->spaces_len, length))
|
||||
return -1;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (!ALIGN_SPACES(&part->char_width, part->spaces_len, length))
|
||||
return -1;
|
||||
#endif
|
||||
@ -379,7 +379,7 @@ get_format_screen_char(struct html_context *html_context,
|
||||
return &schar_cache;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* First possibly do the format change and then find out what coordinates
|
||||
* to use since sub- or superscript might change them */
|
||||
static inline int
|
||||
@ -567,7 +567,7 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
static void
|
||||
move_links(struct html_context *html_context, int xf, int yf, int xt, int yt)
|
||||
@ -799,7 +799,7 @@ split_line_at(struct html_context *html_context, int width)
|
||||
if (part->document) {
|
||||
assert(part->document->data);
|
||||
if_assert_failed return 0;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (html_context->options->utf8
|
||||
&& width < part->spaces_len && part->char_width[width] == 2) {
|
||||
move_chars(html_context, width, part->cy, par_format.leftmargin, part->cy + 1);
|
||||
@ -815,7 +815,7 @@ split_line_at(struct html_context *html_context, int width)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (!(html_context->options->utf8
|
||||
&& width < part->spaces_len
|
||||
&& part->char_width[width] == 2))
|
||||
@ -826,7 +826,7 @@ split_line_at(struct html_context *html_context, int width)
|
||||
if (tmp > 0) {
|
||||
/* 0 is possible and I'm paranoid ... --Zas */
|
||||
memmove(part->spaces, part->spaces + width, tmp);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
memmove(part->char_width, part->char_width + width, tmp);
|
||||
#endif
|
||||
}
|
||||
@ -834,7 +834,7 @@ split_line_at(struct html_context *html_context, int width)
|
||||
assert(tmp >= 0);
|
||||
if_assert_failed tmp = 0;
|
||||
memset(part->spaces + tmp, 0, width);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
memset(part->char_width + tmp, 0, width);
|
||||
#endif
|
||||
|
||||
@ -843,7 +843,7 @@ split_line_at(struct html_context *html_context, int width)
|
||||
assertm(tmp > 0, "part->spaces_len - par_format.leftmargin == %d", tmp);
|
||||
/* So tmp is zero, memmove() should survive that. Don't recover. */
|
||||
memmove(part->spaces + par_format.leftmargin, part->spaces, tmp);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
memmove(part->char_width + par_format.leftmargin, part->char_width, tmp);
|
||||
#endif
|
||||
}
|
||||
@ -883,7 +883,7 @@ split_line(struct html_context *html_context)
|
||||
assert(part);
|
||||
if_assert_failed return 0;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (html_context->options->utf8) {
|
||||
for (x = overlap(par_format); x >= par_format.leftmargin; x--) {
|
||||
|
||||
@ -1343,7 +1343,7 @@ done_link_state_info(void)
|
||||
sizeof(renderer_context.link_state_info));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static inline void
|
||||
process_link(struct html_context *html_context, enum link_state link_state,
|
||||
unsigned char *chars, int charslen, int cells)
|
||||
@ -1351,7 +1351,7 @@ process_link(struct html_context *html_context, enum link_state link_state,
|
||||
static inline void
|
||||
process_link(struct html_context *html_context, enum link_state link_state,
|
||||
unsigned char *chars, int charslen)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
struct part *part = html_context->part;
|
||||
struct link *link;
|
||||
@ -1403,9 +1403,9 @@ process_link(struct html_context *html_context, enum link_state link_state,
|
||||
if (x_offset) {
|
||||
charslen -= x_offset;
|
||||
chars += x_offset;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
cells -= x_offset;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
|
||||
link = new_link(html_context, chars, charslen);
|
||||
@ -1420,17 +1420,17 @@ process_link(struct html_context *html_context, enum link_state link_state,
|
||||
}
|
||||
|
||||
/* Add new canvas positions to the link. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (realloc_points(link, link->npoints + cells))
|
||||
#else
|
||||
if (realloc_points(link, link->npoints + charslen))
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
struct point *point = &link->points[link->npoints];
|
||||
int x = X(part->cx) + x_offset;
|
||||
int y = Y(part->cy);
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
link->npoints += cells;
|
||||
|
||||
for (; cells > 0; cells--, point++, x++)
|
||||
@ -1438,7 +1438,7 @@ process_link(struct html_context *html_context, enum link_state link_state,
|
||||
link->npoints += charslen;
|
||||
|
||||
for (; charslen > 0; charslen--, point++, x++)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
point->x = x;
|
||||
point->y = y;
|
||||
@ -1490,9 +1490,9 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen)
|
||||
{
|
||||
enum link_state link_state;
|
||||
struct part *part;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int cells;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
assert(html_context);
|
||||
if_assert_failed return;
|
||||
@ -1551,21 +1551,21 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen)
|
||||
else if (html_context->options->links_numbering)
|
||||
put_link_number(html_context);
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
cells =
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
set_hline(html_context, chars, charslen, link_state);
|
||||
|
||||
if (link_state != LINK_STATE_NONE) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
process_link(html_context, link_state, chars, charslen,
|
||||
cells);
|
||||
#else
|
||||
process_link(html_context, link_state, chars, charslen);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (renderer_context.nowrap
|
||||
&& part->cx + cells > overlap(par_format))
|
||||
return;
|
||||
@ -1577,7 +1577,7 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen)
|
||||
return;
|
||||
|
||||
part->cx += charslen;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
renderer_context.nobreak = 0;
|
||||
|
||||
@ -1594,11 +1594,11 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen)
|
||||
}
|
||||
|
||||
assert(charslen > 0);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
part->xa += cells;
|
||||
#else
|
||||
part->xa += charslen;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
int_lower_bound(&part->max_width, part->xa
|
||||
+ par_format.leftmargin + par_format.rightmargin
|
||||
- (chars[charslen - 1] == ' '
|
||||
@ -1657,7 +1657,7 @@ end:
|
||||
part->cx = -1;
|
||||
part->xa = 0;
|
||||
memset(part->spaces, 0, part->spaces_len);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
memset(part->char_width, 0, part->spaces_len);
|
||||
#endif
|
||||
}
|
||||
@ -2079,7 +2079,7 @@ format_html_part(struct html_context *html_context,
|
||||
|
||||
done_link_state_info();
|
||||
mem_free_if(part->spaces);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
mem_free_if(part->char_width);
|
||||
#endif
|
||||
|
||||
@ -2165,9 +2165,9 @@ render_html_document(struct cache_entry *cached, struct document *document,
|
||||
&document->cp,
|
||||
&document->cp_status,
|
||||
document->options.hard_assume);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
html_context->options->utf8 = is_cp_utf8(document->options.cp);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
if (title.length) {
|
||||
document->title = convert_string(renderer_context.convert_table,
|
||||
|
@ -23,7 +23,7 @@ struct part {
|
||||
|
||||
unsigned char *spaces;
|
||||
int spaces_len;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unsigned char *char_width;
|
||||
#endif
|
||||
|
||||
|
@ -101,9 +101,9 @@ struct document_options {
|
||||
unsigned int no_cache:1;
|
||||
unsigned int gradual_rerendering:1;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unsigned int utf8:1;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
/* Active link coloring */
|
||||
/* This is mostly here to make use of this option cache so link
|
||||
* drawing is faster. --jonas */
|
||||
|
@ -234,9 +234,9 @@ add_document_line(struct plain_renderer *renderer,
|
||||
struct screen_char *template = &renderer->template;
|
||||
struct screen_char saved_renderer_template = *template;
|
||||
struct screen_char *pos, *startpos;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int utf8 = document->options.utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
int cells = 0;
|
||||
int lineno = renderer->lineno;
|
||||
int expanded = 0;
|
||||
@ -253,7 +253,7 @@ add_document_line(struct plain_renderer *renderer,
|
||||
unsigned char line_char = line[line_pos];
|
||||
int charlen = 1;
|
||||
int cell = 1;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unicode_val_T data;
|
||||
|
||||
if (utf8) {
|
||||
@ -268,7 +268,7 @@ add_document_line(struct plain_renderer *renderer,
|
||||
|
||||
cell = unicode_to_cell(data);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
if (line_char == ASCII_TAB
|
||||
&& (line_pos + charlen == width
|
||||
@ -313,7 +313,7 @@ add_document_line(struct plain_renderer *renderer,
|
||||
unsigned char next_char, prev_char;
|
||||
int charlen = 1;
|
||||
int cell = 1;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unicode_val_T data;
|
||||
|
||||
if (utf8) {
|
||||
@ -328,7 +328,7 @@ add_document_line(struct plain_renderer *renderer,
|
||||
|
||||
cell = unicode_to_cell(data);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
prev_char = line_pos > 0 ? line[line_pos - 1] : '\0';
|
||||
next_char = (line_pos + charlen < width) ?
|
||||
@ -433,7 +433,7 @@ add_document_line(struct plain_renderer *renderer,
|
||||
cells += added_chars - 1;
|
||||
pos += added_chars;
|
||||
} else {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8) {
|
||||
unsigned char *text = &line[line_pos];
|
||||
unicode_val_T data =
|
||||
@ -455,7 +455,7 @@ add_document_line(struct plain_renderer *renderer,
|
||||
cell++;
|
||||
}
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
if (!isscreensafe(line_char))
|
||||
line_char = '.';
|
||||
@ -520,7 +520,7 @@ add_document_lines(struct plain_renderer *renderer)
|
||||
int length = renderer->length;
|
||||
int was_empty_line = 0;
|
||||
int was_wrapped = 0;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int utf8 = is_cp_utf8(renderer->document->cp);
|
||||
#endif
|
||||
for (; length > 0; renderer->lineno++) {
|
||||
@ -552,7 +552,7 @@ add_document_lines(struct plain_renderer *renderer)
|
||||
only_spaces = 0;
|
||||
was_spaces = 0;
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8) {
|
||||
unsigned char *text = &source[width];
|
||||
unicode_val_T data = utf8_to_unicode(&text,
|
||||
@ -563,7 +563,7 @@ add_document_lines(struct plain_renderer *renderer)
|
||||
cells += unicode_to_cell(data);
|
||||
width += utf8charlen(&source[width]);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
cells++;
|
||||
width++;
|
||||
@ -651,9 +651,9 @@ render_plain_document(struct cache_entry *cached, struct document *document,
|
||||
|
||||
document->bgcolor = document->options.default_bg;
|
||||
document->width = 0;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
document->options.utf8 = is_cp_utf8(document->options.cp);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* Setup the style */
|
||||
init_template(&renderer.template, &document->options);
|
||||
|
@ -346,11 +346,11 @@ render_document(struct view_state *vs, struct document_view *doc_view,
|
||||
|
||||
document->title = get_uri_string(document->uri, components);
|
||||
if (document->title) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (doc_view->document->options.utf8)
|
||||
decode_uri(document->title);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
decode_uri_for_display(document->title);
|
||||
}
|
||||
}
|
||||
|
@ -146,10 +146,10 @@ u2cp_(unicode_val_T u, int to, int no_nbsp_hack)
|
||||
|
||||
to &= ~SYSTEM_CHARSET_FLAG;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (codepages[to].table == table_utf_8)
|
||||
return encode_utf8(u);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* To mark non breaking spaces, we use a special char NBSP_CHAR. */
|
||||
if (u == 0xa0) return no_nbsp_hack ? " " : NBSP_CHAR_STRING;
|
||||
@ -175,13 +175,13 @@ u2cp_(unicode_val_T u, int to, int no_nbsp_hack)
|
||||
|
||||
static unsigned char utf_buffer[7];
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
inline unsigned char *
|
||||
encode_utf8(unicode_val_T u)
|
||||
#else
|
||||
static unsigned char *
|
||||
encode_utf8(unicode_val_T u)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
memset(utf_buffer, 0, 7);
|
||||
|
||||
@ -215,7 +215,7 @@ encode_utf8(unicode_val_T u)
|
||||
return utf_buffer;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* Number of bytes utf8 character indexed by first byte. Illegal bytes are
|
||||
* equal ones and handled different. */
|
||||
static char utf8char_len_tab[256] = {
|
||||
@ -621,7 +621,7 @@ utf8_to_unicode(unsigned char **string, unsigned char *end)
|
||||
*string = str + length;
|
||||
return u;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* Slow algorithm, the common part of cp2u and cp2utf8. */
|
||||
static unicode_val_T
|
||||
@ -663,7 +663,7 @@ cp2utf8(int from, int c)
|
||||
return encode_utf8(cp2u_shared(&codepages[from], c));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unicode_val_T
|
||||
cp_to_unicode(int codepage, unsigned char **string, unsigned char *end)
|
||||
{
|
||||
@ -679,7 +679,7 @@ cp_to_unicode(int codepage, unsigned char **string, unsigned char *end)
|
||||
++*string;
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
|
||||
static void
|
||||
@ -900,12 +900,12 @@ get_entity_string(const unsigned char *str, const int strlen, int encoding)
|
||||
|
||||
if (strlen <= 0) return NULL;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* TODO: caching UTF-8 */
|
||||
encoding &= ~SYSTEM_CHARSET_FLAG;
|
||||
if (codepages[encoding].table == table_utf_8)
|
||||
goto skip;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
if (first_time) {
|
||||
memset(&nb_entity_cache, 0, ENTITY_CACHE_MAXLEN * sizeof(unsigned int));
|
||||
@ -960,9 +960,9 @@ get_entity_string(const unsigned char *str, const int strlen, int encoding)
|
||||
fprintf(stderr, "miss\n");
|
||||
#endif
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
skip:
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
if (*str == '#') { /* Numeric entity. */
|
||||
int l = (int) strlen;
|
||||
unsigned char *st = (unsigned char *) str;
|
||||
@ -1014,11 +1014,11 @@ skip:
|
||||
if (element) result = u2cp(element->c, encoding);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (codepages[encoding].table == table_utf_8) {
|
||||
return result;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
end:
|
||||
/* Take care of potential buffer overflow. */
|
||||
if (strlen < sizeof(entity_cache[slen][0].str)) {
|
||||
|
@ -63,7 +63,7 @@ unsigned char *get_cp_name(int);
|
||||
unsigned char *get_cp_mime_name(int);
|
||||
int is_cp_utf8(int);
|
||||
void free_conv_table(void);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
inline unsigned char *encode_utf8(unicode_val_T);
|
||||
inline unsigned char *utf8_prevchar(unsigned char *, int, unsigned char *);
|
||||
inline int utf8charlen(const unsigned char *);
|
||||
@ -96,7 +96,7 @@ unicode_val_T unicode_fold_label_case(unicode_val_T);
|
||||
inline int strlen_utf8(unsigned char **);
|
||||
inline unicode_val_T utf8_to_unicode(unsigned char **, unsigned char *);
|
||||
unicode_val_T cp_to_unicode(int, unsigned char **, unsigned char *);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
unicode_val_T cp2u(int, unsigned char);
|
||||
unsigned char *cp2utf8(int, int);
|
||||
|
@ -119,7 +119,7 @@ get_dyn_full_version(struct terminal *term, int more)
|
||||
#ifndef CONFIG_MOUSE
|
||||
comma, _("No mouse", term),
|
||||
#endif
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
comma, "UTF-8",
|
||||
#endif
|
||||
comma,
|
||||
|
@ -574,11 +574,11 @@ bittorrent_message_dialog(struct session *ses, void *data)
|
||||
|
||||
uristring = get_uri_string(message->uri, URI_PUBLIC);
|
||||
if (uristring) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (ses->tab->term->utf8)
|
||||
decode_uri(uristring);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
decode_uri_for_display(uristring);
|
||||
add_format_to_string(&string,
|
||||
_("Unable to retrieve %s", ses->tab->term),
|
||||
@ -724,11 +724,11 @@ bittorrent_query_callback(void *data, enum connection_state state,
|
||||
|
||||
/* Let's make the filename pretty for display & save */
|
||||
/* TODO: The filename can be the empty string here. See bug 396. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
decode_uri_string(&filename);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
decode_uri_string_for_display(&filename);
|
||||
}
|
||||
|
||||
|
@ -1134,11 +1134,11 @@ do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_hand
|
||||
|
||||
/* Let's make the filename pretty for display & save */
|
||||
/* TODO: The filename can be the empty string here. See bug 396. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
decode_uri_string(&filename);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
decode_uri_string_for_display(&filename);
|
||||
}
|
||||
|
||||
|
@ -268,11 +268,11 @@ print_error_dialog(struct session *ses, enum connection_state state,
|
||||
|
||||
uristring = uri ? get_uri_string(uri, URI_PUBLIC) : NULL;
|
||||
if (uristring) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (ses->tab->term->utf8)
|
||||
decode_uri(uristring);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
decode_uri_for_display(uristring);
|
||||
add_format_to_string(&msg,
|
||||
_("Unable to retrieve %s", ses->tab->term),
|
||||
|
@ -105,11 +105,11 @@ draw_char_color(struct terminal *term, int x, int y, struct color_pair *color)
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
draw_char_data(struct terminal *term, int x, int y, unicode_val_T data)
|
||||
#else
|
||||
draw_char_data(struct terminal *term, int x, int y, unsigned char data)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
struct screen_char *screen_char = get_char(term, x, y);
|
||||
|
||||
@ -117,7 +117,7 @@ draw_char_data(struct terminal *term, int x, int y, unsigned char data)
|
||||
|
||||
screen_char->data = data;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
#ifdef CONFIG_DEBUG
|
||||
/* Detect attempt to draw double-width char on the last
|
||||
* column of terminal. */
|
||||
@ -127,7 +127,7 @@ draw_char_data(struct terminal *term, int x, int y, unsigned char data)
|
||||
|
||||
if (data == UCS_NO_CHAR)
|
||||
screen_char->attr = 0;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
set_screen_dirty(term->screen, y, y);
|
||||
}
|
||||
@ -147,7 +147,7 @@ draw_line(struct terminal *term, int x, int y, int l, struct screen_char *line)
|
||||
size = int_min(l, term->width - x);
|
||||
if (size == 0) return;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
struct screen_char *sc;
|
||||
|
||||
@ -250,7 +250,7 @@ draw_border(struct terminal *term, struct box *box,
|
||||
set_screen_dirty(term->screen, borderbox.y, borderbox.y + borderbox.height);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* Checks cells left and right to the box for broken double-width chars.
|
||||
* Replace it with ' '.
|
||||
* 1+---+3
|
||||
@ -321,7 +321,7 @@ fix_dwchar_around_box(struct terminal *term, struct box *box, int border,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
void
|
||||
draw_char(struct terminal *term, int x, int y,
|
||||
unicode_val_T data, enum screen_char_attr attr,
|
||||
@ -331,7 +331,7 @@ void
|
||||
draw_char(struct terminal *term, int x, int y,
|
||||
unsigned char data, enum screen_char_attr attr,
|
||||
struct color_pair *color)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
struct screen_char *screen_char = get_char(term, x, y);
|
||||
|
||||
@ -407,7 +407,7 @@ draw_shadow(struct terminal *term, struct box *box,
|
||||
draw_box(term, &dbox, ' ', 0, color);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static void
|
||||
draw_text_utf8(struct terminal *term, int x, int y,
|
||||
unsigned char *text, int length,
|
||||
@ -479,7 +479,7 @@ draw_text_utf8(struct terminal *term, int x, int y,
|
||||
set_screen_dirty(term->screen, y, y);
|
||||
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
void
|
||||
draw_text(struct terminal *term, int x, int y,
|
||||
@ -492,12 +492,12 @@ draw_text(struct terminal *term, int x, int y,
|
||||
assert(text && length >= 0);
|
||||
if_assert_failed return;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
draw_text_utf8(term, x, y, text, length, attr, color);
|
||||
return;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
if (length <= 0) return;
|
||||
pos = get_char(term, x, y);
|
||||
|
@ -31,11 +31,11 @@ enum screen_char_attr {
|
||||
/* One position in the terminal screen's image. */
|
||||
struct screen_char {
|
||||
/* Contains either character value or frame data. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unicode_val_T data;
|
||||
#else
|
||||
unsigned char data;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* Attributes are screen_char_attr bits. */
|
||||
unsigned char attr;
|
||||
@ -214,11 +214,11 @@ void draw_char_color(struct terminal *term, int x, int y,
|
||||
struct color_pair *color);
|
||||
|
||||
/* Sets the data of a screen position. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
void draw_char_data(struct terminal *term, int x, int y, unicode_val_T data);
|
||||
#else
|
||||
void draw_char_data(struct terminal *term, int x, int y, unsigned char data);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* Sets the data to @border and of a screen position. */
|
||||
void draw_border_char(struct terminal *term, int x, int y,
|
||||
@ -229,7 +229,7 @@ void draw_border_cross(struct terminal *, int x, int y,
|
||||
enum border_cross_direction, struct color_pair *color);
|
||||
|
||||
/* Draws a char. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
void draw_char(struct terminal *term, int x, int y,
|
||||
unicode_val_T data, enum screen_char_attr attr,
|
||||
struct color_pair *color);
|
||||
@ -237,7 +237,7 @@ void draw_char(struct terminal *term, int x, int y,
|
||||
void draw_char(struct terminal *term, int x, int y,
|
||||
unsigned char data, enum screen_char_attr attr,
|
||||
struct color_pair *color);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* Draws area defined by @box using the same colors and attributes. */
|
||||
void draw_box(struct terminal *term, struct box *box,
|
||||
@ -252,10 +252,10 @@ void draw_shadow(struct terminal *term, struct box *box,
|
||||
void draw_border(struct terminal *term, struct box *box,
|
||||
struct color_pair *color, int width);
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
void fix_dwchar_around_box(struct terminal *term, struct box *box, int border,
|
||||
int shadow_width, int shadow_height);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* Draws @length chars from @text. */
|
||||
void draw_text(struct terminal *term, int x, int y,
|
||||
|
@ -136,12 +136,12 @@ static void
|
||||
term_send_ucs(struct terminal *term, unicode_val_T u,
|
||||
term_event_modifier_T modifier)
|
||||
{
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
struct term_event ev;
|
||||
|
||||
set_kbd_term_event(&ev, u, modifier);
|
||||
term_send_event(term, &ev);
|
||||
#else /* !CONFIG_UTF_8 */
|
||||
#else /* !CONFIG_UTF8 */
|
||||
struct term_event ev;
|
||||
unsigned char *recoded;
|
||||
|
||||
@ -153,7 +153,7 @@ term_send_ucs(struct terminal *term, unicode_val_T u,
|
||||
term_send_event(term, &ev);
|
||||
recoded++;
|
||||
}
|
||||
#endif /* !CONFIG_UTF_8 */
|
||||
#endif /* !CONFIG_UTF8 */
|
||||
}
|
||||
|
||||
static void
|
||||
@ -178,12 +178,12 @@ check_terminal_name(struct terminal *term, struct terminal_info *info)
|
||||
object_unlock(term->spec);
|
||||
term->spec = get_opt_rec(config_options, name);
|
||||
object_lock(term->spec);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* Probably not best place for set this. But now we finally have
|
||||
* term->spec and term->utf8 should be set before decode session info.
|
||||
* --Scrool */
|
||||
term->utf8 = get_opt_bool_tree(term->spec, "utf_8_io");
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MOUSE
|
||||
@ -295,7 +295,7 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
|
||||
}
|
||||
|
||||
/* Character Conversions. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* struct term_event_keyboard carries UCS-4.
|
||||
* - If the "utf_8_io" option (i.e. term->utf8) is
|
||||
* true or the "charset" option refers to UTF-8,
|
||||
@ -317,7 +317,7 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
|
||||
* - Otherwise, handle_interlink_event() passes the
|
||||
* bytes straight through. */
|
||||
utf8_io = get_opt_bool_tree(term->spec, "utf_8_io");
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* In UTF-8 byte sequences that have more than one byte, the
|
||||
* first byte is between 0xC0 and 0xFF and the remaining bytes
|
||||
@ -366,7 +366,7 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
|
||||
* UTF-8 start and continuation bytes or UTF-8 I/O mode
|
||||
* is disabled. */
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (key >= 0 && key <= 0xFF && !utf8_io) {
|
||||
/* Not special and UTF-8 mode is disabled:
|
||||
* recode from the terminal charset to UCS-4. */
|
||||
@ -377,7 +377,7 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
|
||||
term_send_ucs(term, key, modifier);
|
||||
break;
|
||||
}
|
||||
#endif /* !CONFIG_UTF_8 */
|
||||
#endif /* !CONFIG_UTF8 */
|
||||
|
||||
/* It must be special (e.g., F1 or Enter)
|
||||
* or a single-byte UTF-8 character. */
|
||||
|
@ -6,7 +6,7 @@
|
||||
struct itrm;
|
||||
|
||||
/* A character received from a terminal. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
typedef unicode_val_T term_event_char_T; /* in UCS-4 */
|
||||
#else
|
||||
typedef unsigned char term_event_char_T; /* in the charset of the terminal */
|
||||
|
@ -31,7 +31,7 @@
|
||||
unsigned char frame_dumb[48] = " ||||++||++++++--|-+||++--|-+----++++++++ ";
|
||||
static unsigned char frame_vt100[48] = "aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmllnnjla ";
|
||||
|
||||
#ifndef CONFIG_UTF_8
|
||||
#ifndef CONFIG_UTF8
|
||||
/* For UTF8 I/O */
|
||||
static unsigned char frame_vt100_u[48] = {
|
||||
177, 177, 177, 179, 180, 180, 180, 191,
|
||||
@ -41,7 +41,7 @@ static unsigned char frame_vt100_u[48] = {
|
||||
193, 194, 194, 192, 192, 218, 218, 197,
|
||||
197, 217, 218, 177, 32, 32, 32, 32
|
||||
};
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
static unsigned char frame_freebsd[48] = {
|
||||
130, 138, 128, 153, 150, 150, 150, 140,
|
||||
@ -81,12 +81,12 @@ static struct string m11_hack_frame_seqs[] = {
|
||||
/* begin border: */ TERM_STRING("\033[11m"),
|
||||
};
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static struct string utf8_linux_frame_seqs[] = {
|
||||
/* end border: */ TERM_STRING("\033[10m\033%G"),
|
||||
/* begin border: */ TERM_STRING("\033%@\033[11m"),
|
||||
};
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
static struct string vt100_frame_seqs[] = {
|
||||
/* end border: */ TERM_STRING("\x0f"),
|
||||
@ -109,12 +109,12 @@ struct screen_driver {
|
||||
* uniquely identify the screen_driver. */
|
||||
enum term_mode_type type;
|
||||
|
||||
#ifndef CONFIG_UTF_8
|
||||
#ifndef CONFIG_UTF8
|
||||
/* Charsets when doing UTF8 I/O. */
|
||||
/* [0] is the common charset and [1] is the frame charset.
|
||||
* Test wether to use UTF8 I/O using the use_utf8_io() macro. */
|
||||
int charsets[2];
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* The frame translation table. May be NULL. */
|
||||
unsigned char *frame;
|
||||
@ -131,10 +131,10 @@ struct screen_driver {
|
||||
/* These are directly derived from the terminal options. */
|
||||
unsigned int transparent:1;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* UTF-8 I/O */
|
||||
unsigned int utf8:1;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* The terminal._template_ name. */
|
||||
unsigned char name[1]; /* XXX: Keep last! */
|
||||
@ -143,81 +143,81 @@ struct screen_driver {
|
||||
static struct screen_driver dumb_screen_driver = {
|
||||
NULL_LIST_HEAD,
|
||||
/* type: */ TERM_DUMB,
|
||||
#ifndef CONFIG_UTF_8
|
||||
#ifndef CONFIG_UTF8
|
||||
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
/* frame: */ frame_dumb,
|
||||
/* frame_seqs: */ NULL,
|
||||
/* underline: */ underline_seqs,
|
||||
/* color_mode: */ COLOR_MODE_16,
|
||||
/* transparent: */ 1,
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* utf-8: */ 0,
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
};
|
||||
|
||||
static struct screen_driver vt100_screen_driver = {
|
||||
NULL_LIST_HEAD,
|
||||
/* type: */ TERM_VT100,
|
||||
#ifndef CONFIG_UTF_8
|
||||
#ifndef CONFIG_UTF8
|
||||
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
/* frame: */ frame_vt100,
|
||||
/* frame_seqs: */ vt100_frame_seqs,
|
||||
/* underline: */ underline_seqs,
|
||||
/* color_mode: */ COLOR_MODE_16,
|
||||
/* transparent: */ 1,
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* utf-8: */ 0,
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
};
|
||||
|
||||
static struct screen_driver linux_screen_driver = {
|
||||
NULL_LIST_HEAD,
|
||||
/* type: */ TERM_LINUX,
|
||||
#ifndef CONFIG_UTF_8
|
||||
#ifndef CONFIG_UTF8
|
||||
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
/* frame: */ NULL, /* No restrict_852 */
|
||||
/* frame_seqs: */ NULL, /* No m11_hack */
|
||||
/* underline: */ underline_seqs,
|
||||
/* color_mode: */ COLOR_MODE_16,
|
||||
/* transparent: */ 1,
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* utf-8: */ 0,
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
};
|
||||
|
||||
static struct screen_driver koi8_screen_driver = {
|
||||
NULL_LIST_HEAD,
|
||||
/* type: */ TERM_KOI8,
|
||||
#ifndef CONFIG_UTF_8
|
||||
#ifndef CONFIG_UTF8
|
||||
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
/* frame: */ frame_koi,
|
||||
/* frame_seqs: */ NULL,
|
||||
/* underline: */ underline_seqs,
|
||||
/* color_mode: */ COLOR_MODE_16,
|
||||
/* transparent: */ 1,
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* utf-8: */ 0,
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
};
|
||||
|
||||
static struct screen_driver freebsd_screen_driver = {
|
||||
NULL_LIST_HEAD,
|
||||
/* type: */ TERM_FREEBSD,
|
||||
#ifndef CONFIG_UTF_8
|
||||
#ifndef CONFIG_UTF8
|
||||
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
/* frame: */ frame_freebsd,
|
||||
/* frame_seqs: */ NULL, /* No m11_hack */
|
||||
/* underline: */ underline_seqs,
|
||||
/* color_mode: */ COLOR_MODE_16,
|
||||
/* transparent: */ 1,
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* utf-8: */ 0,
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
};
|
||||
|
||||
/* XXX: Keep in sync with enum term_mode_type. */
|
||||
@ -229,22 +229,22 @@ static struct screen_driver *screen_drivers[] = {
|
||||
/* TERM_FREEBSD: */ &freebsd_screen_driver,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
#define use_utf8_io(driver) ((driver)->utf8)
|
||||
#else
|
||||
#define use_utf8_io(driver) ((driver)->charsets[0] != -1)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
static INIT_LIST_HEAD(active_screen_drivers);
|
||||
|
||||
static void
|
||||
update_screen_driver(struct screen_driver *driver, struct option *term_spec)
|
||||
{
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
driver->utf8 = get_opt_bool_tree(term_spec, "utf_8_io");
|
||||
#else
|
||||
int utf8_io = get_opt_bool_tree(term_spec, "utf_8_io");
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
driver->color_mode = get_opt_int_tree(term_spec, "colors");
|
||||
driver->transparent = get_opt_bool_tree(term_spec, "transparency");
|
||||
@ -255,7 +255,7 @@ update_screen_driver(struct screen_driver *driver, struct option *term_spec)
|
||||
driver->underline = NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (driver->type == TERM_LINUX) {
|
||||
if (get_opt_bool_tree(term_spec, "restrict_852"))
|
||||
driver->frame = frame_restrict;
|
||||
@ -312,7 +312,7 @@ update_screen_driver(struct screen_driver *driver, struct option *term_spec)
|
||||
driver->frame = frame_vt100;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
|
||||
static int
|
||||
@ -351,9 +351,9 @@ add_screen_driver(enum term_mode_type type, struct terminal *term, int env_len)
|
||||
|
||||
term->spec->change_hook = screen_driver_change_hook;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
term->utf8 = use_utf8_io(driver);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
return driver;
|
||||
}
|
||||
@ -373,9 +373,9 @@ get_screen_driver(struct terminal *term)
|
||||
/* Some simple probably useless MRU ;) */
|
||||
move_to_top_of_list(active_screen_drivers, driver);
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
term->utf8 = use_utf8_io(driver);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
return driver;
|
||||
}
|
||||
|
||||
@ -518,7 +518,7 @@ copy_color_16(unsigned char *a, unsigned char *b)
|
||||
a[0] = b[0];
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static inline void
|
||||
add_char_data(struct string *screen, struct screen_driver *driver,
|
||||
unicode_val_T data, unsigned char border)
|
||||
@ -526,7 +526,7 @@ add_char_data(struct string *screen, struct screen_driver *driver,
|
||||
static inline void
|
||||
add_char_data(struct string *screen, struct screen_driver *driver,
|
||||
unsigned char data, unsigned char border)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
if (!isscreensafe(data)) {
|
||||
add_char_to_string(screen, ' ');
|
||||
@ -537,7 +537,7 @@ add_char_data(struct string *screen, struct screen_driver *driver,
|
||||
data = driver->frame[data - 176];
|
||||
|
||||
if (use_utf8_io(driver)) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (border)
|
||||
add_char_to_string(screen, (unsigned char)data);
|
||||
else
|
||||
@ -547,7 +547,7 @@ add_char_data(struct string *screen, struct screen_driver *driver,
|
||||
int charset = driver->charsets[!!border];
|
||||
|
||||
add_to_string(screen, cp2utf8(charset, data));
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
return;
|
||||
}
|
||||
|
||||
@ -564,9 +564,9 @@ add_char16(struct string *screen, struct screen_driver *driver,
|
||||
unsigned char bold = (ch->attr & SCREEN_ATTR_BOLD);
|
||||
|
||||
if (
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
border != state->border && driver->frame_seqs
|
||||
) {
|
||||
state->border = border;
|
||||
@ -574,9 +574,9 @@ add_char16(struct string *screen, struct screen_driver *driver,
|
||||
}
|
||||
|
||||
if (
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
underline != state->underline && driver->underline
|
||||
) {
|
||||
state->underline = underline;
|
||||
@ -584,9 +584,9 @@ add_char16(struct string *screen, struct screen_driver *driver,
|
||||
}
|
||||
|
||||
if (
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
bold != state->bold
|
||||
) {
|
||||
state->bold = bold;
|
||||
@ -599,9 +599,9 @@ add_char16(struct string *screen, struct screen_driver *driver,
|
||||
}
|
||||
|
||||
if (
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
!compare_color_16(ch->color, state->color)
|
||||
) {
|
||||
copy_color_16(state->color, ch->color);
|
||||
@ -706,9 +706,9 @@ add_char256(struct string *screen, struct screen_driver *driver,
|
||||
unsigned char attr_delta = (ch->attr ^ state->attr);
|
||||
|
||||
if (
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
attr_delta
|
||||
) {
|
||||
if ((attr_delta & SCREEN_ATTR_FRAME) && driver->frame_seqs) {
|
||||
@ -734,9 +734,9 @@ add_char256(struct string *screen, struct screen_driver *driver,
|
||||
}
|
||||
|
||||
if (
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
!compare_color_256(ch->color, state->color)
|
||||
) {
|
||||
copy_color_256(state->color, ch->color);
|
||||
@ -821,9 +821,9 @@ add_char_true(struct string *screen, struct screen_driver *driver,
|
||||
unsigned char attr_delta = (ch->attr ^ state->attr);
|
||||
|
||||
if (
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
attr_delta
|
||||
) {
|
||||
if ((attr_delta & SCREEN_ATTR_FRAME) && driver->frame_seqs) {
|
||||
@ -849,9 +849,9 @@ add_char_true(struct string *screen, struct screen_driver *driver,
|
||||
}
|
||||
|
||||
if (
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
!compare_color_true(ch->color, state->color)
|
||||
) {
|
||||
copy_color_true(state->color, ch->color);
|
||||
|
@ -126,10 +126,10 @@ struct terminal {
|
||||
* work and even maintaining these structures ;-). */
|
||||
unsigned int master:1;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* Indicates whether UTF-8 I/O is used */
|
||||
unsigned int utf8:1;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* Indicates whether Linux console was in UTF-8 mode on startup */
|
||||
unsigned int linux_was_utf8:1;
|
||||
|
@ -355,10 +355,10 @@ add_document_to_string(struct string *string, struct document *document)
|
||||
assert(string && document);
|
||||
if_assert_failed return NULL;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (is_cp_utf8(document->options.cp))
|
||||
goto utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
for (y = 0; y < document->height; y++) {
|
||||
int white = 0;
|
||||
@ -392,7 +392,7 @@ add_document_to_string(struct string *string, struct document *document)
|
||||
|
||||
add_char_to_string(string, '\n');
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
goto end;
|
||||
utf8:
|
||||
for (y = 0; y < document->height; y++) {
|
||||
@ -430,7 +430,7 @@ utf8:
|
||||
add_char_to_string(string, '\n');
|
||||
}
|
||||
end:
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
return string;
|
||||
}
|
||||
|
||||
@ -849,10 +849,10 @@ dump_to_file(struct document *document, int fd)
|
||||
|
||||
if (!buf) return -1;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (is_cp_utf8(document->options.cp))
|
||||
goto utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
for (y = 0; y < document->height; y++) {
|
||||
int white = 0;
|
||||
@ -890,7 +890,7 @@ dump_to_file(struct document *document, int fd)
|
||||
if (write_char('\n', fd, buf, &bptr))
|
||||
goto fail;
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
goto ref;
|
||||
utf8:
|
||||
for (y = 0; y < document->height; y++) {
|
||||
@ -939,7 +939,7 @@ utf8:
|
||||
goto fail;
|
||||
}
|
||||
ref:
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
if (hard_write(fd, buf, bptr) != bptr) {
|
||||
fail:
|
||||
|
@ -163,10 +163,10 @@ init_form_state(struct form_control *fc, struct form_state *fs)
|
||||
case FC_TEXTAREA:
|
||||
fs->value = stracpy(fc->default_value);
|
||||
fs->state = strlen(fc->default_value);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (fc->type == FC_TEXTAREA)
|
||||
fs->state_cell = 0;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
fs->vpos = 0;
|
||||
break;
|
||||
case FC_FILE:
|
||||
@ -334,10 +334,10 @@ draw_form_entry(struct terminal *term, struct document_view *doc_view,
|
||||
dy = box->y - vs->y;
|
||||
switch (fc->type) {
|
||||
unsigned char *s;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
unsigned char *text, *end, *last_in_view;
|
||||
int retried;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
int len;
|
||||
int i, x, y;
|
||||
|
||||
@ -351,9 +351,9 @@ draw_form_entry(struct terminal *term, struct document_view *doc_view,
|
||||
break;
|
||||
|
||||
x = link->points[0].x + dx;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) goto utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
int_bounds(&fs->vpos, fs->state - fc->size + 1, fs->state);
|
||||
len = strlen(fs->value) - fs->vpos;
|
||||
|
||||
@ -371,7 +371,7 @@ draw_form_entry(struct terminal *term, struct document_view *doc_view,
|
||||
draw_char_data(term, x, y, data);
|
||||
}
|
||||
break;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
utf8:
|
||||
retried = 0;
|
||||
|
||||
@ -487,7 +487,7 @@ drew_char:
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
case FC_TEXTAREA:
|
||||
draw_textarea(term, fs, doc_view, link);
|
||||
break;
|
||||
@ -506,9 +506,9 @@ drew_char:
|
||||
else
|
||||
/* XXX: when can this happen? --pasky */
|
||||
s = "";
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) goto utf8_select;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
len = s ? strlen(s) : 0;
|
||||
for (i = 0; i < link->npoints; i++) {
|
||||
x = link->points[i].x + dx;
|
||||
@ -517,7 +517,7 @@ drew_char:
|
||||
draw_char_data(term, x, y, i < len ? s[i] : '_');
|
||||
}
|
||||
break;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
utf8_select:
|
||||
text = s;
|
||||
end = strchr(s, '\0');
|
||||
@ -546,7 +546,7 @@ utf8_select:
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
case FC_SUBMIT:
|
||||
case FC_IMAGE:
|
||||
case FC_RESET:
|
||||
@ -1356,9 +1356,9 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
unsigned char *text;
|
||||
int length;
|
||||
enum frame_event_status status = FRAME_EVENT_REFRESH;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int utf8 = ses->tab->term->utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
assert(ses && doc_view && link && ev);
|
||||
if_assert_failed return FRAME_EVENT_OK;
|
||||
@ -1378,7 +1378,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
|
||||
switch (action_id) {
|
||||
case ACT_EDIT_LEFT:
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (fc->type == FC_TEXTAREA) {
|
||||
status = textarea_op_left(fs, fc, utf8);
|
||||
break;
|
||||
@ -1389,11 +1389,11 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
new_value = utf8_prevchar(fs->value + fs->state, 1, fs->value);
|
||||
fs->state = new_value - fs->value;
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
fs->state = int_max(fs->state - 1, 0);
|
||||
break;
|
||||
case ACT_EDIT_RIGHT:
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (fc->type == FC_TEXTAREA) {
|
||||
status = textarea_op_right(fs, fc, utf8);
|
||||
break;
|
||||
@ -1405,11 +1405,11 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
utf8_to_unicode(&text, end);
|
||||
fs->state = (int)(text - fs->value);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
fs->state = int_min(fs->state + 1, strlen(fs->value));
|
||||
break;
|
||||
case ACT_EDIT_HOME:
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (fc->type == FC_TEXTAREA) {
|
||||
status = textarea_op_home(fs, fc, utf8);
|
||||
} else {
|
||||
@ -1422,58 +1422,58 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
fs->state = 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
break;
|
||||
case ACT_EDIT_UP:
|
||||
if (fc->type != FC_TEXTAREA)
|
||||
status = FRAME_EVENT_IGNORED;
|
||||
else
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
status = textarea_op_up(fs, fc, utf8);
|
||||
#else
|
||||
status = textarea_op_up(fs, fc);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
break;
|
||||
case ACT_EDIT_DOWN:
|
||||
if (fc->type != FC_TEXTAREA)
|
||||
status = FRAME_EVENT_IGNORED;
|
||||
else
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
status = textarea_op_down(fs, fc, utf8);
|
||||
#else
|
||||
status = textarea_op_down(fs, fc);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
break;
|
||||
case ACT_EDIT_END:
|
||||
if (fc->type == FC_TEXTAREA) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
status = textarea_op_end(fs, fc, utf8);
|
||||
#else
|
||||
status = textarea_op_end(fs, fc);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
} else {
|
||||
fs->state = strlen(fs->value);
|
||||
}
|
||||
break;
|
||||
case ACT_EDIT_BEGINNING_OF_BUFFER:
|
||||
if (fc->type == FC_TEXTAREA) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
status = textarea_op_bob(fs, fc, utf8);
|
||||
fs->state_cell = 0;
|
||||
#else
|
||||
status = textarea_op_bob(fs, fc);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
} else {
|
||||
fs->state = 0;
|
||||
}
|
||||
break;
|
||||
case ACT_EDIT_END_OF_BUFFER:
|
||||
if (fc->type == FC_TEXTAREA) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
status = textarea_op_eob(fs, fc, utf8);
|
||||
#else
|
||||
status = textarea_op_eob(fs, fc);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
} else {
|
||||
fs->state = strlen(fs->value);
|
||||
}
|
||||
@ -1493,10 +1493,10 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
if (!form_field_is_readonly(fc))
|
||||
fs->value[0] = 0;
|
||||
fs->state = 0;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (fc->type == FC_TEXTAREA)
|
||||
fs->state_cell = 0;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
break;
|
||||
case ACT_EDIT_PASTE_CLIPBOARD:
|
||||
if (form_field_is_readonly(fc)) break;
|
||||
@ -1512,21 +1512,21 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
fs->value = v;
|
||||
memmove(v, text, length + 1);
|
||||
fs->state = strlen(fs->value);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8 && fc->type == FC_TEXTAREA)
|
||||
fs->state_cell = 0;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
}
|
||||
mem_free(text);
|
||||
break;
|
||||
case ACT_EDIT_ENTER:
|
||||
if (fc->type == FC_TEXTAREA) {
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
status = textarea_op_enter(fs, fc, utf8);
|
||||
#else
|
||||
status = textarea_op_enter(fs, fc);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1551,7 +1551,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
status = FRAME_EVENT_OK;
|
||||
break;
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8) {
|
||||
int old_state = fs->state;
|
||||
unsigned char *new_value;
|
||||
@ -1566,7 +1566,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
memmove(new_value, fs->value + old_state, length);
|
||||
}
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
length = strlen(fs->value + fs->state) + 1;
|
||||
text = fs->value + fs->state;
|
||||
@ -1586,7 +1586,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
status = FRAME_EVENT_OK;
|
||||
break;
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8) {
|
||||
unsigned char *end = fs->value + length;
|
||||
unsigned char *text = fs->value + fs->state;
|
||||
@ -1599,7 +1599,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
text = fs->value + fs->state;
|
||||
|
||||
memmove(text, text + 1, length - fs->state);
|
||||
@ -1629,12 +1629,12 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
memmove(text, fs->value + fs->state, length);
|
||||
|
||||
fs->state = (int) (text - fs->value);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8) {
|
||||
if (fc->type == FC_TEXTAREA)
|
||||
fs->state_cell = 0;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
break;
|
||||
case ACT_EDIT_KILL_TO_EOL:
|
||||
if (form_field_is_readonly(fc)) {
|
||||
@ -1733,17 +1733,17 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
}
|
||||
|
||||
if (form_field_is_readonly(fc)
|
||||
#ifndef CONFIG_UTF_8
|
||||
#ifndef CONFIG_UTF8
|
||||
|| strlen(fs->value) >= fc->maxlength
|
||||
|| !insert_in_string(&fs->value, fs->state, "?", 1)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
)
|
||||
{
|
||||
status = FRAME_EVENT_OK;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
{
|
||||
/* The charset of the terminal; we assume
|
||||
* fs->value is in this charset.
|
||||
@ -1766,7 +1766,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
}
|
||||
#else
|
||||
fs->value[fs->state++] = get_kbd_key(ev);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -51,11 +51,11 @@ struct form_state {
|
||||
* For FC_SELECT, @state is the index of the selected item
|
||||
* in @form_control.labels. */
|
||||
int state;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* For FC_TEXT, FC_PASSWORD, and FC_FILE, @state_cell is not
|
||||
* used. */
|
||||
int state_cell;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
/* For FC_TEXT, FC_PASSWORD, and FC_FILE, @vpos is the index
|
||||
* of the first displayed byte in @value. It should never be
|
||||
* in the middle of a character. */
|
||||
|
@ -114,9 +114,9 @@ get_link_cursor_offset(struct document_view *doc_view, struct link *link)
|
||||
{
|
||||
struct form_control *fc;
|
||||
struct form_state *fs;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int utf8 = doc_view->document->options.utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
switch (link->type) {
|
||||
case LINK_CHECKBOX:
|
||||
@ -130,7 +130,7 @@ get_link_cursor_offset(struct document_view *doc_view, struct link *link)
|
||||
fs = find_form_state(doc_view, fc);
|
||||
if (!fs || !fs->value)
|
||||
return 0;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
else if (utf8) {
|
||||
unsigned char *scroll = fs->value + fs->vpos;
|
||||
unsigned char *point = fs->value + fs->state;
|
||||
@ -140,18 +140,18 @@ get_link_cursor_offset(struct document_view *doc_view, struct link *link)
|
||||
else
|
||||
return utf8_ptr2cells(scroll, point);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
else
|
||||
return fs->state - fs->vpos;
|
||||
|
||||
case LINK_AREA:
|
||||
fc = get_link_form_control(link);
|
||||
fs = find_form_state(doc_view, fc);
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
return fs ? area_cursor(fc, fs, utf8) : 0;
|
||||
#else
|
||||
return fs ? area_cursor(fc, fs) : 0;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
case LINK_HYPERTEXT:
|
||||
case LINK_MAP:
|
||||
@ -1203,13 +1203,13 @@ try_document_key(struct session *ses, struct document_view *doc_view,
|
||||
|
||||
/* The key is a character. Convert it to Unicode so that it
|
||||
* can be compared with link.accesskey. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
key = get_kbd_key(ev);
|
||||
#else /* !CONFIG_UTF_8 */
|
||||
#else /* !CONFIG_UTF8 */
|
||||
key = cp2u(get_opt_codepage_tree(ses->tab->term->spec,
|
||||
"charset"),
|
||||
get_kbd_key(ev));
|
||||
#endif /* !CONFIG_UTF_8 */
|
||||
#endif /* !CONFIG_UTF8 */
|
||||
/* If @key now is 0 (which is used in link.accesskey if there
|
||||
* is no access key) or UCS_REPLACEMENT_CHARACTER, then the
|
||||
* results may be a little odd, but not really harmful. */
|
||||
@ -1402,9 +1402,9 @@ get_current_link_title(struct document_view *doc_view)
|
||||
doc_view->document->options.cp,
|
||||
CSM_DEFAULT, NULL, NULL, NULL);
|
||||
/* Remove illicit chars. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (link_title && !doc_view->document->options.utf8)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
for (src = link_title; *src; src++)
|
||||
if (!isprint(*src) || iscntrl(*src))
|
||||
*src = '*';
|
||||
@ -1457,11 +1457,11 @@ get_current_link_info(struct session *ses, struct document_view *doc_view)
|
||||
add_char_to_string(&str, ')');
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8)
|
||||
decode_uri_string(&str);
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
decode_uri_string_for_display(&str);
|
||||
return str.source;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <ctype.h> /* tolower(), isprint() */
|
||||
|
||||
#if defined(CONFIG_UTF_8) && defined(HAVE_WCTYPE_H)
|
||||
#if defined(CONFIG_UTF8) && defined(HAVE_WCTYPE_H)
|
||||
#include <wctype.h>
|
||||
#endif
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
static INIT_INPUT_HISTORY(search_history);
|
||||
|
||||
#undef UCHAR
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
#define UCHAR unicode_val_T
|
||||
#else
|
||||
#define UCHAR unsigned char
|
||||
@ -456,7 +456,7 @@ is_in_range_regex(struct document *document, int y, int height,
|
||||
static UCHAR *
|
||||
memacpy_u(unsigned char *text, int textlen, int utf8)
|
||||
{
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
UCHAR *mem = mem_alloc((textlen + 1) * sizeof(UCHAR));
|
||||
|
||||
if (!mem) return NULL;
|
||||
@ -481,7 +481,7 @@ memacpy_u(unsigned char *text, int textlen, int utf8)
|
||||
static int
|
||||
strlen_u(unsigned char *text, int utf8)
|
||||
{
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8)
|
||||
return strlen_utf8(&text);
|
||||
#endif
|
||||
@ -500,7 +500,7 @@ lowered_string(unsigned char *text, int textlen, int utf8)
|
||||
ret = memacpy_u(text, textlen, utf8);
|
||||
if (ret && textlen) {
|
||||
do {
|
||||
#if defined(CONFIG_UTF_8) && defined(HAVE_WCTYPE_H)
|
||||
#if defined(CONFIG_UTF8) && defined(HAVE_WCTYPE_H)
|
||||
ret[textlen] = utf8 ? towlower(ret[textlen]) : tolower(ret[textlen]);
|
||||
#else
|
||||
ret[textlen] = tolower(ret[textlen]);
|
||||
@ -530,7 +530,7 @@ is_in_range_plain(struct document *document, int y, int height,
|
||||
* trivial, probably a starter; very fast as well) or Turbo-BM (or
|
||||
* maybe some other Boyer-Moore variant, I don't feel that strong in
|
||||
* this area), hmm? >:) --pasky */
|
||||
#if defined(CONFIG_UTF_8) && defined(HAVE_WCTYPE_H)
|
||||
#if defined(CONFIG_UTF8) && defined(HAVE_WCTYPE_H)
|
||||
#define maybe_tolower(c) (case_sensitive ? (c) : utf8 ? towlower(c) : tolower(c))
|
||||
#else
|
||||
#define maybe_tolower(c) (case_sensitive ? (c) : tolower(c))
|
||||
@ -579,7 +579,7 @@ is_in_range(struct document *document, int y, int height,
|
||||
assert(document && text && min && max);
|
||||
if_assert_failed return -1;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
utf8 = document->options.utf8;
|
||||
#endif
|
||||
*min = INT_MAX, *max = 0;
|
||||
@ -619,7 +619,7 @@ get_searched_plain(struct document_view *doc_view, struct point **pt, int *pl,
|
||||
xoffset = box->x - doc_view->vs->x;
|
||||
yoffset = box->y - doc_view->vs->y;
|
||||
|
||||
#if defined(CONFIG_UTF_8) && defined(HAVE_WCTYPE_H)
|
||||
#if defined(CONFIG_UTF8) && defined(HAVE_WCTYPE_H)
|
||||
#define maybe_tolower(c) (case_sensitive ? (c) : utf8 ? towlower(c) : tolower(c))
|
||||
#else
|
||||
#define maybe_tolower(c) (case_sensitive ? (c) : tolower(c))
|
||||
@ -777,7 +777,7 @@ draw_searched(struct terminal *term, struct document_view *doc_view)
|
||||
if (!has_search_word(doc_view))
|
||||
return;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
utf8 = doc_view->document->options.utf8;
|
||||
#endif
|
||||
get_searched(doc_view, &pt, &len, utf8);
|
||||
@ -924,7 +924,7 @@ static int
|
||||
find_next_link_in_search(struct document_view *doc_view, int direction)
|
||||
{
|
||||
int utf8 = 0;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
utf8 = doc_view->document->options.utf8;
|
||||
#endif
|
||||
|
||||
|
@ -40,11 +40,11 @@
|
||||
struct line_info {
|
||||
int start;
|
||||
int end;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int last_char_width;
|
||||
int split_prev:1;
|
||||
int split_next:1;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
};
|
||||
|
||||
/* We add two extra entries to the table so the ending info can be added
|
||||
@ -52,7 +52,7 @@ struct line_info {
|
||||
#define realloc_line_info(info, size) \
|
||||
mem_align_alloc(info, size, (size) + 3, 0xFF)
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
/* Allocates a line_info table describing the layout of the textarea buffer.
|
||||
*
|
||||
* @width is max width and the offset at which text will be wrapped
|
||||
@ -134,7 +134,7 @@ format_textutf8(unsigned char *text, int width, enum form_wrap wrap, int format)
|
||||
|
||||
return line;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* Allocates a line_info table describing the layout of the textarea buffer.
|
||||
*
|
||||
@ -226,7 +226,7 @@ get_textarea_line_number(struct line_info *line, int cursor_position)
|
||||
|
||||
/* Fixes up the vpos and vypos members of the form_state. Returns the
|
||||
* logical position in the textarea view. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int
|
||||
area_cursor(struct form_control *fc, struct form_state *fs, int utf8)
|
||||
{
|
||||
@ -313,7 +313,7 @@ area_cursor(struct form_control *fc, struct form_state *fs)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static void
|
||||
draw_textarea_utf8(struct terminal *term, struct form_state *fs,
|
||||
struct document_view *doc_view, struct link *link)
|
||||
@ -395,7 +395,7 @@ draw_textarea_utf8(struct terminal *term, struct form_state *fs,
|
||||
|
||||
mem_free(linex);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
void
|
||||
draw_textarea(struct terminal *term, struct form_state *fs,
|
||||
@ -411,12 +411,12 @@ draw_textarea(struct terminal *term, struct form_state *fs,
|
||||
assert(term && doc_view && doc_view->document && doc_view->vs && link);
|
||||
if_assert_failed return;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (term->utf8) {
|
||||
draw_textarea_utf8(term, fs, doc_view, link);
|
||||
return;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
fc = get_link_form_control(link);
|
||||
assertm(fc, "link %d has no form control", (int) (link - doc_view->document->links));
|
||||
if_assert_failed return;
|
||||
@ -426,11 +426,11 @@ draw_textarea(struct terminal *term, struct form_state *fs,
|
||||
vy = doc_view->vs->y;
|
||||
|
||||
if (!link->npoints) return;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
area_cursor(fc, fs, 0);
|
||||
#else
|
||||
area_cursor(fc, fs);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
linex = format_text(fs->value, fc->cols, fc->wrap, 0);
|
||||
if (!linex) return;
|
||||
line = linex;
|
||||
@ -686,7 +686,7 @@ menu_textarea_edit(struct terminal *term, void *xxx, void *ses_)
|
||||
textarea_edit(0, term, fs, doc_view, link);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static enum frame_event_status
|
||||
textarea_op(struct form_state *fs, struct form_control *fc, int utf8,
|
||||
int (*do_op)(struct form_state *, struct line_info *, int, int))
|
||||
@ -743,9 +743,9 @@ textarea_op(struct form_state *fs, struct form_control *fc,
|
||||
|
||||
return fs->state == state ? FRAME_EVENT_OK : FRAME_EVENT_REFRESH;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
void
|
||||
new_pos(struct form_state *fs, struct line_info *line, int current, int max_cells)
|
||||
{
|
||||
@ -761,27 +761,27 @@ new_pos(struct form_state *fs, struct line_info *line, int current, int max_cell
|
||||
}
|
||||
fs->state = (int)(text - fs->value);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
static int
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
do_op_home(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||
#else
|
||||
do_op_home(struct form_state *fs, struct line_info *line, int current)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
if (current == -1)
|
||||
return 0;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (utf8)
|
||||
fs->state = line[current - !!fs->state_cell].start;
|
||||
else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
fs->state = line[current].start;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static int
|
||||
do_op_up(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||
{
|
||||
@ -835,9 +835,9 @@ do_op_up(struct form_state *fs, struct line_info *line, int current)
|
||||
int_upper_bound(&fs->state, line[current-1].end);
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static int
|
||||
do_op_down(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||
{
|
||||
@ -889,9 +889,9 @@ do_op_down(struct form_state *fs, struct line_info *line, int current)
|
||||
int_upper_bound(&fs->state, line[current+1].end);
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static int
|
||||
do_op_end(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||
{
|
||||
@ -937,14 +937,14 @@ do_op_end(struct form_state *fs, struct line_info *line, int current)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
static int
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
do_op_bob(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||
#else
|
||||
do_op_bob(struct form_state *fs, struct line_info *line, int current)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
if (current == -1) return 0;
|
||||
|
||||
@ -954,11 +954,11 @@ do_op_bob(struct form_state *fs, struct line_info *line, int current)
|
||||
}
|
||||
|
||||
static int
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
do_op_eob(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||
#else
|
||||
do_op_eob(struct form_state *fs, struct line_info *line, int current)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
if (current == -1) {
|
||||
fs->state = strlen(fs->value);
|
||||
@ -974,7 +974,7 @@ do_op_eob(struct form_state *fs, struct line_info *line, int current)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
enum frame_event_status
|
||||
textarea_op_home(struct form_state *fs, struct form_control *fc, int utf8)
|
||||
{
|
||||
@ -986,9 +986,9 @@ textarea_op_home(struct form_state *fs, struct form_control *fc)
|
||||
{
|
||||
return textarea_op(fs, fc, do_op_home);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
enum frame_event_status
|
||||
textarea_op_up(struct form_state *fs, struct form_control *fc, int utf8)
|
||||
{
|
||||
@ -1000,9 +1000,9 @@ textarea_op_up(struct form_state *fs, struct form_control *fc)
|
||||
{
|
||||
return textarea_op(fs, fc, do_op_up);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
enum frame_event_status
|
||||
textarea_op_down(struct form_state *fs, struct form_control *fc, int utf8)
|
||||
{
|
||||
@ -1014,9 +1014,9 @@ textarea_op_down(struct form_state *fs, struct form_control *fc)
|
||||
{
|
||||
return textarea_op(fs, fc, do_op_down);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
enum frame_event_status
|
||||
textarea_op_end(struct form_state *fs, struct form_control *fc, int utf8)
|
||||
{
|
||||
@ -1028,11 +1028,11 @@ textarea_op_end(struct form_state *fs, struct form_control *fc)
|
||||
{
|
||||
return textarea_op(fs, fc, do_op_end);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* Set the form state so the cursor is on the first line of the buffer.
|
||||
* Preserve the column if possible. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
enum frame_event_status
|
||||
textarea_op_bob(struct form_state *fs, struct form_control *fc, int utf8)
|
||||
{
|
||||
@ -1044,13 +1044,13 @@ textarea_op_bob(struct form_state *fs, struct form_control *fc)
|
||||
{
|
||||
return textarea_op(fs, fc, do_op_bob);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* Set the form state so the cursor is on the last line of the buffer. Preserve
|
||||
* the column if possible. This is done by getting current and last line and
|
||||
* then shifting the state by the delta of both lines start position bounding
|
||||
* the whole thing to the end of the last line. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
enum frame_event_status
|
||||
textarea_op_eob(struct form_state *fs, struct form_control *fc, int utf8)
|
||||
{
|
||||
@ -1062,14 +1062,14 @@ textarea_op_eob(struct form_state *fs, struct form_control *fc)
|
||||
{
|
||||
return textarea_op(fs, fc, do_op_eob);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
enum frame_event_status
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
textarea_op_enter(struct form_state *fs, struct form_control *fc, int utf8)
|
||||
#else
|
||||
textarea_op_enter(struct form_state *fs, struct form_control *fc)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
assert(fs && fs->value && fc);
|
||||
if_assert_failed return FRAME_EVENT_OK;
|
||||
@ -1083,7 +1083,7 @@ textarea_op_enter(struct form_state *fs, struct form_control *fc)
|
||||
return FRAME_EVENT_REFRESH;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
static int
|
||||
do_op_left(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||
{
|
||||
@ -1147,9 +1147,9 @@ do_op_right(struct form_state *fs, struct line_info *line, int current, int utf8
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
enum frame_event_status
|
||||
textarea_op_left(struct form_state *fs, struct form_control *fc, int utf8)
|
||||
{
|
||||
@ -1161,7 +1161,7 @@ textarea_op_right(struct form_state *fs, struct form_control *fc, int utf8)
|
||||
{
|
||||
return textarea_op(fs, fc, utf8, do_op_right);
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
void
|
||||
set_textarea(struct document_view *doc_view, int direction)
|
||||
@ -1169,9 +1169,9 @@ set_textarea(struct document_view *doc_view, int direction)
|
||||
struct form_control *fc;
|
||||
struct form_state *fs;
|
||||
struct link *link;
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int utf8 = doc_view->document->options.utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
assert(doc_view && doc_view->vs && doc_view->document);
|
||||
assert(direction == 1 || direction == -1);
|
||||
@ -1192,7 +1192,7 @@ set_textarea(struct document_view *doc_view, int direction)
|
||||
|
||||
/* Depending on which way we entered the textarea move cursor so that
|
||||
* it is available at end or start. */
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
if (direction == 1)
|
||||
textarea_op_eob(fs, fc, utf8);
|
||||
else
|
||||
@ -1202,5 +1202,5 @@ set_textarea(struct document_view *doc_view, int direction)
|
||||
textarea_op_eob(fs, fc);
|
||||
else
|
||||
textarea_op_bob(fs, fc);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
|
@ -13,11 +13,11 @@ struct link;
|
||||
struct session;
|
||||
struct terminal;
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
int area_cursor(struct form_control *fc, struct form_state *fs, int utf8);
|
||||
#else
|
||||
int area_cursor(struct form_control *fc, struct form_state *fs);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
void draw_textarea(struct terminal *term, struct form_state *fs, struct document_view *doc_view, struct link *link);
|
||||
unsigned char *encode_textarea(struct submitted_value *sv);
|
||||
|
||||
@ -25,7 +25,7 @@ extern int textarea_editor;
|
||||
void textarea_edit(int, struct terminal *, struct form_state *, struct document_view *, struct link *);
|
||||
void menu_textarea_edit(struct terminal *term, void *xxx, void *ses_);
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
#ifdef CONFIG_UTF8
|
||||
enum frame_event_status textarea_op_home(struct form_state *fs, struct form_control *fc, int utf8);
|
||||
enum frame_event_status textarea_op_up(struct form_state *fs, struct form_control *fc, int utf8);
|
||||
enum frame_event_status textarea_op_down(struct form_state *fs, struct form_control *fc, int utf8);
|
||||
@ -43,7 +43,7 @@ enum frame_event_status textarea_op_end(struct form_state *fs, struct form_contr
|
||||
enum frame_event_status textarea_op_bob(struct form_state *fs, struct form_control *fc);
|
||||
enum frame_event_status textarea_op_eob(struct form_state *fs, struct form_control *fc);
|
||||
enum frame_event_status textarea_op_enter(struct form_state *fs, struct form_control *fc);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
void set_textarea(struct document_view *doc_view, int direction);
|
||||
|
||||
|
@ -645,7 +645,7 @@ try_mark_key(struct session *ses, struct document_view *doc_view,
|
||||
* is something else (i.e. a special key or a non-ASCII
|
||||
* character), map it to an ASCII character that the functions
|
||||
* will not accept, so the results are consistent.
|
||||
* When CONFIG_UTF_8 is not defined, this assumes that codes
|
||||
* When CONFIG_UTF8 is not defined, this assumes that codes
|
||||
* 0 to 0x7F in all codepages match ASCII. */
|
||||
if (key >= 0 && key <= 0x7F)
|
||||
mark = (unsigned char) key;
|
||||
|
Loading…
Reference in New Issue
Block a user