View | Details | Raw Unified
Collapse All | Expand All

(-) links-2.1pre15/language.h.orig (-16 / +169 lines)
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_COPY_LINK_LOCATION, "C",
T_HK_COPY_LINK_LOCATION, "C",
T_HK_COPY_URL_LOCATION, "C",
T_HK_COPY_URL_LOCATION, "C",
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_COPY_LINK_LOCATION, "C",
T_HK_COPY_LINK_LOCATION, "C",
T_HK_COPY_URL_LOCATION, "C",
T_HK_COPY_URL_LOCATION, "C",
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "D",
T_HK_MISCELANEOUS_OPTIONS, "D",
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "A",
T_HK_MISCELANEOUS_OPTIONS, "A",
T_HK_COPY_LINK_LOCATION, "O",
T_HK_COPY_LINK_LOCATION, "O",
T_HK_COPY_URL_LOCATION, "U",
T_HK_COPY_URL_LOCATION, "U",
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "M",
T_HK_MISCELANEOUS_OPTIONS, "M",
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_COPY_LINK_LOCATION, "C",
T_HK_COPY_LINK_LOCATION, "C",
T_HK_COPY_URL_LOCATION, "U",
T_HK_COPY_URL_LOCATION, "U",
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "À",
T_HK_MISCELANEOUS_OPTIONS, "À",
T_HK_COPY_LINK_LOCATION, "Ü",
T_HK_COPY_LINK_LOCATION, "Ü",
T_HK_COPY_URL_LOCATION, "â",
T_HK_COPY_URL_LOCATION, "â",
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_MISCELANEOUS_OPTIONS, "O",
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 492-494    Link Here 
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_MISCELANEOUS_OPTIONS, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_LINK_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_HK_COPY_URL_LOCATION, NULL,
T_UTF_8_IO, "UTF-8 I/O",
 Lines 84-90    Link Here 
#define U_EQUAL(a, b) (a).x == (b)
#define U_EQUAL(a, b) (a).x == (b)
#define U_ABOVE(a, b) (a).x > (b)
#define U_ABOVE(a, b) (a).x > (b)
static inline unsigned char *u2cp(int u, int to)
unsigned char *u2cp(int u, int to)
{
{
	int j, s;
	int j, s;
	if (u < 128) return strings[u];
	if (u < 128) return strings[u];
 Lines 144-149    Link Here 
	return utf_buffer;
	return utf_buffer;
}
}
/* this slow and ugly code is used by the terminal utf_8_io */
unsigned char *cp2utf_8(int from, int c)
{
	int j;
	if (codepages[from].table == table_utf_8) return strings[c];
	for (j = 0; codepages[from].table[j].c; j++) {
		if (codepages[from].table[j].c == c)
		{
			return encode_utf_8(codepages[from].table[j].u);
		}
	}
	if (c < 128) return strings[c];
	return encode_utf_8(UCS_NO_CHAR);
}
void add_utf_8(struct conv_table *ct, int u, unsigned char *str)
void add_utf_8(struct conv_table *ct, int u, unsigned char *str)
{
{
	unsigned char *p = encode_utf_8(u);
	unsigned char *p = encode_utf_8(u);
 Lines 634-639    Link Here 
	}
	}
}
}
/* terminal NAME(str) MODE(0-3) M11_HACK(0-1) BLOCK_CURSOR.RESTRICT_852.COL(0-7) CHARSET(str) [ UTF_8_IO("utf-8") ]*/
unsigned char *term_rd(struct option *o, unsigned char *c)
unsigned char *term_rd(struct option *o, unsigned char *c)
{
{
	struct term_spec *ts;
	struct term_spec *ts;
 Lines 644-649    Link Here 
		mem_free(w);
		mem_free(w);
		goto end;
		goto end;
	}
	}
        ts->utf_8_io = 0;
	mem_free(w);
	mem_free(w);
	if (!(w = get_token(&c))) goto err;
	if (!(w = get_token(&c))) goto err;
	if (strlen(w) != 1 || w[0] < '0' || w[0] > '4') goto err_f;
	if (strlen(w) != 1 || w[0] < '0' || w[0] > '4') goto err_f;
 Lines 664-669    Link Here 
	if ((i = get_cp_index(w)) == -1) goto err_f;
	if ((i = get_cp_index(w)) == -1) goto err_f;
	ts->charset = i;
	ts->charset = i;
	mem_free(w);
	mem_free(w);
	if (!(w = get_token(&c))) goto end;
	if (!(strcasecmp(w, "utf-8"))) ts->utf_8_io = 1;
	mem_free(w);
	end:
	end:
	return NULL;
	return NULL;
	err_f:
	err_f:
 Lines 672-677    Link Here 
	return "Error reading terminal specification";
	return "Error reading terminal specification";
}
}
/* terminal2 NAME(str) MODE(0-3) M11_HACK(0-1) RESTRICT_852(0-1) COL(0-1) CHARSET(str) [ UTF_8_IO("utf-8") ]*/
unsigned char *term2_rd(struct option *o, unsigned char *c)
unsigned char *term2_rd(struct option *o, unsigned char *c)
{
{
	struct term_spec *ts;
	struct term_spec *ts;
 Lines 682-687    Link Here 
		mem_free(w);
		mem_free(w);
		goto end;
		goto end;
	}
	}
        ts->utf_8_io = 0;
	mem_free(w);
	mem_free(w);
	if (!(w = get_token(&c))) goto err;
	if (!(w = get_token(&c))) goto err;
	if (strlen(w) != 1 || w[0] < '0' || w[0] > '3') goto err_f;
	if (strlen(w) != 1 || w[0] < '0' || w[0] > '3') goto err_f;
 Lines 703-708    Link Here 
	if ((i = get_cp_index(w)) == -1) goto err_f;
	if ((i = get_cp_index(w)) == -1) goto err_f;
	ts->charset = i;
	ts->charset = i;
	mem_free(w);
	mem_free(w);
	if (!(w = get_token(&c))) goto end;
	if (!(strcasecmp(w, "utf-8"))) ts->utf_8_io = 1;
	mem_free(w);
	end:
	end:
	return NULL;
	return NULL;
	err_f:
	err_f:
 Lines 725-730    Link Here 
		add_num_to_str(s, l, !!ts->col + !!ts->restrict_852 * 2 + !!ts->block_cursor * 4);
		add_num_to_str(s, l, !!ts->col + !!ts->restrict_852 * 2 + !!ts->block_cursor * 4);
		add_to_str(s, l, " ");
		add_to_str(s, l, " ");
		add_to_str(s, l, get_cp_mime_name(ts->charset));
		add_to_str(s, l, get_cp_mime_name(ts->charset));
                if (ts->utf_8_io)
                {
                    add_to_str(s, l, " utf-8");
                }
	}
	}
}
}
 Lines 1757-1762    Link Here 
#ifdef G
#ifdef G
	struct graphics_device *dev;
	struct graphics_device *dev;
#endif
#endif
	struct {
		int ucs;
		int len;
		int min;
	} utf_8;
};
};
struct term_spec {
struct term_spec {
 Lines 1765-1770    Link Here 
	unsigned char term[MAX_TERM_LEN];
	unsigned char term[MAX_TERM_LEN];
	int mode;
	int mode;
	int m11_hack;
	int m11_hack;
	int utf_8_io;
	int restrict_852;
	int restrict_852;
	int block_cursor;
	int block_cursor;
	int col;
	int col;
 Lines 3234-3239    Link Here 
/* charsets.c */
/* charsets.c */
/* UCS/Unicode replacement character */
#define UCS_NO_CHAR 0xFFFD
#include "codepage.h"
#include "codepage.h"
extern int utf8_table;
extern int utf8_table;
 Lines 3256-3261    Link Here 
void free_conv_table(void);
void free_conv_table(void);
unsigned char *encode_utf_8(int);
unsigned char *encode_utf_8(int);
int cp2u(unsigned char, int);
int cp2u(unsigned char, int);
unsigned char *cp2utf_8(int, int);
unsigned char *u2cp(int, int);
#ifdef G
#ifdef G
int get_utf_8(unsigned char **p);
int get_utf_8(unsigned char **p);
 Lines 462-476    Link Here 
	cls_redraw_all_terminals();
	cls_redraw_all_terminals();
}
}
unsigned char *td_labels[] = { TEXT(T_NO_FRAMES), TEXT(T_VT_100_FRAMES), TEXT(T_LINUX_OR_OS2_FRAMES), TEXT(T_KOI8R_FRAMES), TEXT(T_FREEBSD_FRAMES), TEXT(T_USE_11M), TEXT(T_RESTRICT_FRAMES_IN_CP850_852), TEXT(T_BLOCK_CURSOR), TEXT(T_COLOR), TEXT(T_BRAILLE_TERMINAL), NULL };
unsigned char *td_labels[] = { TEXT(T_NO_FRAMES), TEXT(T_VT_100_FRAMES), TEXT(T_LINUX_OR_OS2_FRAMES), TEXT(T_KOI8R_FRAMES), TEXT(T_FREEBSD_FRAMES), TEXT(T_USE_11M), TEXT(T_RESTRICT_FRAMES_IN_CP850_852), TEXT(T_BLOCK_CURSOR), TEXT(T_COLOR), TEXT(T_BRAILLE_TERMINAL), TEXT(T_UTF_8_IO), NULL };
void terminal_options(struct terminal *term, void *xxx, struct session *ses)
void terminal_options(struct terminal *term, void *xxx, struct session *ses)
{
{
	struct dialog *d;
	struct dialog *d;
	struct term_spec *ts = new_term_spec(term->term);
	struct term_spec *ts = new_term_spec(term->term);
	if (!ts) return;
	if (!ts) return;
	if (!(d = mem_alloc(sizeof(struct dialog) + 12 * sizeof(struct dialog_item)))) return;
 	if (!(d = mem_alloc(sizeof(struct dialog) + 14 * sizeof(struct dialog_item)))) return;
	memset(d, 0, sizeof(struct dialog) + 12 * sizeof(struct dialog_item));
 	memset(d, 0, sizeof(struct dialog) + 14 * sizeof(struct dialog_item));
	d->title = TEXT(T_TERMINAL_OPTIONS);
	d->title = TEXT(T_TERMINAL_OPTIONS);
	d->fn = checkbox_list_fn;
	d->fn = checkbox_list_fn;
	d->udata = td_labels;
	d->udata = td_labels;
 Lines 520-534    Link Here 
	d->items[9].gid = 0;
	d->items[9].gid = 0;
	d->items[9].dlen = sizeof(int);
	d->items[9].dlen = sizeof(int);
	d->items[9].data = (void *)&ts->braille;
	d->items[9].data = (void *)&ts->braille;
	d->items[10].type = D_BUTTON;
	d->items[10].type = D_CHECKBOX;
	d->items[10].gid = B_ENTER;
	d->items[10].gid = 0;
	d->items[10].fn = ok_dialog;
	d->items[10].dlen = sizeof(int);
	d->items[10].text = TEXT(T_OK);
	d->items[10].data = (void *)&ts->utf_8_io;
	d->items[11].type = D_BUTTON;
	d->items[11].type = D_BUTTON;
	d->items[11].gid = B_ESC;
	d->items[11].gid = B_ENTER;
	d->items[11].fn = cancel_dialog;
	d->items[11].fn = ok_dialog;
	d->items[11].text = TEXT(T_CANCEL);
	d->items[11].text = TEXT(T_OK);
	d->items[12].type = D_END;
	d->items[12].type = D_BUTTON;
	d->items[12].gid = B_ESC;
	d->items[12].fn = cancel_dialog;
	d->items[12].text = TEXT(T_CANCEL);
	d->items[13].type = D_END;
 	do_dialog(term, d, getml(d, NULL));
 	do_dialog(term, d, getml(d, NULL));
}
}
 Lines 694-699    Link Here 
#endif
#endif
static inline void term_send_event(struct terminal *term, struct event *ev)
{
	((struct window *)&term->windows)->next->handler(term->windows.next, ev, 0);
}
static inline void term_send_ucs(struct terminal *term, struct event *ev, int u)
{
	unsigned char *recoded;
	if (u == 0xA0) u = ' ';
	recoded = u2cp(u, term->spec->charset);
	if (! recoded) recoded = "*";
	while (*recoded) {
		ev->x = *recoded;
		term_send_event(term, ev);
		recoded ++;
	}
}
void in_term(struct terminal *term)
void in_term(struct terminal *term)
{
{
	struct event *ev;
	struct event *ev;
 Lines 755-761    Link Here 
			goto send_redraw;
			goto send_redraw;
		}
		}
		else if (ev->ev == EV_KBD && ev->x == KBD_CTRL_C) ((struct window *)&term->windows)->prev->handler(term->windows.prev, ev, 0);
		else if (ev->ev == EV_KBD && ev->x == KBD_CTRL_C) ((struct window *)&term->windows)->prev->handler(term->windows.prev, ev, 0);
		else ((struct window *)&term->windows)->next->handler(term->windows.next, ev, 0);
		else if (ev->ev == EV_KBD) {
			if (term->utf_8.len) {
				if ((ev->x & 0xC0) == 0x80 && term->spec->utf_8_io) {
					term->utf_8.ucs <<= 6;
					term->utf_8.ucs |= ev->x & 0x3F;
					if (! --term->utf_8.len) {
						int u = term->utf_8.ucs;
						if (u < term->utf_8.min) u = UCS_NO_CHAR;
						term_send_ucs(term, ev, u);
					}
					goto mm;
				} else {
					term->utf_8.len = 0;
					term_send_ucs(term, ev, UCS_NO_CHAR);
				}
			}
			if (ev->x < 0x80 || ev->x > 0xFF || ! term->spec->utf_8_io) {
				term_send_event(term, ev);
				goto mm;
			} else if ((ev->x & 0xC0) == 0xC0 && (ev->x & 0xFE) != 0xFE) {
				int mask, len = 0, cov = 0x80;
				for (mask = 0x80; ev->x & mask; mask >>= 1) {
					len++;
					term->utf_8.min = cov;
					cov = 1 << (1 + 5 * len);
				}
				term->utf_8.len = len - 1;
				term->utf_8.ucs = ev->x & (mask - 1);
				goto mm;
			}
			term_send_ucs(term, ev, UCS_NO_CHAR);
		} else term_send_event(term, ev);
	}
	}
	if (ev->ev == EV_ABORT) {
	if (ev->ev == EV_ABORT) {
		destroy_terminal(term);
		destroy_terminal(term);
 Lines 775-780    Link Here 
unsigned char frame_dumb[48] =	"   ||||++||++++++--|-+||++--|-+----++++++++     ";
unsigned char frame_dumb[48] =	"   ||||++||++++++--|-+||++--|-+----++++++++     ";
unsigned char frame_vt100[48] =	"aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmllnnjla    ";
unsigned char frame_vt100[48] =	"aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmllnnjla    ";
unsigned char frame_vt100_u[48] = {
	177,177,177,179,180,180,180,191,
	191,180,179,191,217,217,217,191,
	192,193,194,195,196,197,195,195,
	192,218,193,194,195,196,197,193,
	193,194,194,192,192,218,218,197,
	197,217,218,177, 32, 32, 32, 32
};
unsigned char frame_koi[48] = {
unsigned char frame_koi[48] = {
	144,145,146,129,135,178,180,167,
	144,145,146,129,135,178,180,167,
	166,181,161,168,174,173,172,131,
	166,181,161,168,174,173,172,131,
 Lines 806-812    Link Here 
	unsigned char c = ch & 0xff;							\
	unsigned char c = ch & 0xff;							\
	unsigned char A = ch >> 8 & 0x7f;						\
	unsigned char A = ch >> 8 & 0x7f;						\
	if (s->mode == TERM_LINUX) {							\
	if (s->mode == TERM_LINUX) {							\
		if (s->m11_hack) {							\
		if (s->m11_hack && !s->utf_8_io) {					\
			if (ch >> 15 != mode) {						\
			if (ch >> 15 != mode) {						\
				if (!(mode = ch >> 15)) add_to_str(&a, &l, "\033[10m");	\
				if (!(mode = ch >> 15)) add_to_str(&a, &l, "\033[10m");	\
				else add_to_str(&a, &l, "\033[11m");			\
				else add_to_str(&a, &l, "\033[11m");			\
 Lines 815-826    Link Here 
		if (s->restrict_852 && (ch >> 15) && c >= 176 && c < 224) {		\
		if (s->restrict_852 && (ch >> 15) && c >= 176 && c < 224) {		\
			if (frame_restrict[c - 176]) c = frame_restrict[c - 176];	\
			if (frame_restrict[c - 176]) c = frame_restrict[c - 176];	\
		}									\
		}									\
	} else if (s->mode == TERM_VT100) {						\
	} else if (s->mode == TERM_VT100 && !s->utf_8_io) {				\
		if (ch >> 15 != mode) {							\
		if (ch >> 15 != mode) {							\
			if (!(mode = ch >> 15)) add_to_str(&a, &l, "\x0f");		\
			if (!(mode = ch >> 15)) add_to_str(&a, &l, "\x0f");		\
			else add_to_str(&a, &l, "\x0e");				\
			else add_to_str(&a, &l, "\x0e");				\
		}									\
		}									\
		if (mode && c >= 176 && c < 224) c = frame_vt100[c - 176];		\
		if (mode && c >= 176 && c < 224) c = frame_vt100[c - 176];		\
	} else if (s->mode == TERM_VT100 && (ch >> 15) && c >= 176 && c < 224) {	\
		c = frame_vt100_u[c - 176];						\
	} else if (s->mode == TERM_KOI8 && (ch >> 15) && c >= 176 && c < 224) { c = frame_koi[c - 176];\
	} else if (s->mode == TERM_KOI8 && (ch >> 15) && c >= 176 && c < 224) { c = frame_koi[c - 176];\
	} else if (s->mode == TERM_FREEBSD && (ch >> 15) && c >= 176 && c < 224) { c = frame_freebsd[c - 176];\
	} else if (s->mode == TERM_FREEBSD && (ch >> 15) && c >= 176 && c < 224) { c = frame_freebsd[c - 176];\
	} else if (s->mode == TERM_DUMB && (ch >> 15) && c >= 176 && c < 224) c = frame_dumb[c - 176];\
	} else if (s->mode == TERM_DUMB && (ch >> 15) && c >= 176 && c < 224) c = frame_dumb[c - 176];\
 Lines 841-847    Link Here 
		if (attrib & 0100) add_to_str(&a, &l, ";1");				\
		if (attrib & 0100) add_to_str(&a, &l, ";1");				\
		add_to_str(&a, &l, "m");						\
		add_to_str(&a, &l, "m");						\
	}										\
	}										\
	if (c >= ' ' && c != 127/* && c != 155*/) add_chr_to_str(&a, &l, c);		\
	if (c >= ' ' && c != 127/* && c != 155*/) {					\
		int charset = s->charset;						\
											\
		if (ch >> 15) {								\
			int frames_charset = (s->mode == TERM_LINUX || s->mode == TERM_VT100) \
						? get_cp_index("cp437")			\
						: s->mode == TERM_KOI8			\
						? get_cp_index("koi8-r")		\
						: -1;					\
			if (frames_charset != -1) charset = frames_charset;		\
		}									\
		if (s->utf_8_io) add_to_str(&a, &l, cp2utf_8(charset, c));		\
		else add_chr_to_str(&a, &l, c);						\
	}										\
	else if (!c || c == 1) add_chr_to_str(&a, &l, ' ');				\
	else if (!c || c == 1) add_chr_to_str(&a, &l, ' ');				\
	else add_chr_to_str(&a, &l, '.');						\
	else add_chr_to_str(&a, &l, '.');						\
	cx++;										\
	cx++;										\
 Lines 497-499    Link Here 
#define T_HK_COPY_LINK_LOCATION    493	
#define T_HK_COPY_LINK_LOCATION    493	
#define T_HK_COPY_URL_LOCATION    494	
#define T_HK_COPY_URL_LOCATION    494	
#define T__N_TEXTS    495	
#define T__N_TEXTS    495	
#define T_UTF_8_IO    496