-static int alt_x, alt_y, alt_om, alt_wrap, alt_wnext, alt_ins, alt_cset;
-static int alt_t, alt_b;
-static int alt_which;
-
-#define ARGS_MAX 32 /* max # of esc sequence arguments */
-#define ARG_DEFAULT 0 /* if an arg isn't specified */
-#define def(a,d) ( (a) == ARG_DEFAULT ? (d) : (a) )
-static int esc_args[ARGS_MAX];
-static int esc_nargs;
-static int esc_query;
-#define ANSI(x,y) ((x)+((y)<<8))
-#define ANSI_QUE(x) ANSI(x,TRUE)
-
-#define OSC_STR_MAX 2048
-static int osc_strlen;
-static char osc_string[OSC_STR_MAX + 1];
-static int osc_w;
-
-static char id_string[1024] = "\033[?6c";
-
-static unsigned char *tabs;
-
-static enum {
- TOPLEVEL,
- SEEN_ESC,
- SEEN_CSI,
- SEEN_OSC,
- SEEN_OSC_W,
-
- DO_CTRLS,
-
- IGNORE_NEXT,
- SET_GL, SET_GR,
- SEEN_OSC_P,
- OSC_STRING, OSC_MAYBE_ST,
- SEEN_ESCHASH,
- VT52_ESC,
- VT52_Y1,
- VT52_Y2
-} termstate;
-
-static enum {
- NO_SELECTION, ABOUT_TO, DRAGGING, SELECTED
-} selstate;
-static enum {
- SM_CHAR, SM_WORD, SM_LINE
-} selmode;
-static pos selstart, selend, selanchor;
-
-static short wordness[256] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, /* 01 */
- 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 1, 1, 1, 1, 1, 1, /* 23 */
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 1, 1, 1, 1, 2, /* 45 */
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 1, 1, 1, 1, 1, /* 67 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, /* 89 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, /* AB */
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, /* CD */
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, /* EF */
-};
-
-static unsigned char sel_nl[] = SEL_NL;
-static char *paste_buffer = 0;
-static int paste_len, paste_pos, paste_hold;