2 * Internals of the Terminal structure, for those other modules
3 * which need to look inside it. It would be nice if this could be
4 * folded back into terminal.c in future, with an abstraction layer
5 * to handle everything that other modules need to know about it;
6 * but for the moment, this will do.
9 #ifndef PUTTY_TERMINAL_H
10 #define PUTTY_TERMINAL_H
15 struct beeptime *next;
25 int compatibility_level;
27 tree234 *scrollback; /* lines scrolled off top of screen */
28 tree234 *screen; /* lines on primary screen */
29 tree234 *alt_screen; /* lines on alternate screen */
30 int disptop; /* distance scrolled back (0 or -ve) */
32 unsigned long *cpos; /* cursor position (convenience) */
34 unsigned long *disptext; /* buffer of text on real screen */
35 unsigned long *dispcurs; /* location of cursor on real screen */
36 unsigned long curstype; /* type of cursor on real screen */
38 #define VBELL_TIMEOUT (TICKSPERSEC/10) /* visual bell lasts 1/10 sec */
40 struct beeptime *beephead, *beeptail;
45 #define TSIZE (sizeof(unsigned long))
46 #define fix_cpos do { \
47 term->cpos = lineptr(term->curs.y) + term->curs.x; \
50 unsigned long curr_attr, save_attr;
51 unsigned long erase_char;
53 bufchain inbuf; /* terminal input buffer */
54 pos curs; /* cursor */
55 pos savecurs; /* saved cursor position */
56 int marg_t, marg_b; /* scroll margins */
57 int dec_om; /* DEC origin mode flag */
58 int wrap, wrapnext; /* wrap flags */
59 int insert; /* insert-mode flag */
60 int cset; /* 0 or 1: which char set */
61 int save_cset, save_csattr; /* saved with cursor position */
62 int save_utf, save_wnext; /* saved with cursor position */
63 int rvideo; /* global reverse video flag */
64 unsigned long rvbell_startpoint; /* for ESC[?5hESC[?5l vbell */
65 int cursor_on; /* cursor enabled flag */
66 int reset_132; /* Flag ESC c resets to 80 cols */
67 int use_bce; /* Use Background coloured erase */
68 int blinker; /* When blinking is the cursor on ? */
69 int tblinker; /* When the blinking text is on */
70 int blink_is_real; /* Actually blink blinking text */
71 int term_echoing; /* Does terminal want local echo? */
72 int term_editing; /* Does terminal want local edit? */
73 int sco_acs, save_sco_acs; /* CSI 10,11,12m -> OEM charset */
74 int vt52_bold; /* Force bold on non-bold colours */
75 int utf; /* Are we in toggleable UTF-8 mode? */
76 int utf_state; /* Is there a pending UTF-8 character */
77 int utf_char; /* and what is it so far. */
78 int utf_size; /* The size of the UTF character. */
79 int printing, only_printing; /* Are we doing ANSI printing? */
80 int print_state; /* state of print-end-sequence scan */
81 bufchain printer_buf; /* buffered data for printer */
82 printer_job *print_job;
84 int rows, cols, savelines;
87 unsigned long vbell_startpoint;
88 int app_cursor_keys, app_keypad_keys, vt52_mode;
89 int repeat_off, cr_lf_return;
93 long last_blink; /* used for real blinking control */
96 int xterm_mouse; /* send mouse messages to app */
97 int mouse_is_down; /* used while tracking mouse buttons */
99 unsigned long cset_attr[2];
102 * Saved settings on the alternate screen.
104 int alt_x, alt_y, alt_om, alt_wrap, alt_wnext, alt_ins;
105 int alt_cset, alt_sco_acs, alt_utf;
109 #define ARGS_MAX 32 /* max # of esc sequence arguments */
110 #define ARG_DEFAULT 0 /* if an arg isn't specified */
111 #define def(a,d) ( (a) == ARG_DEFAULT ? (d) : (a) )
112 int esc_args[ARGS_MAX];
115 #define ANSI(x,y) ((x)+((y)<<8))
116 #define ANSI_QUE(x) ANSI(x,TRUE)
118 #define OSC_STR_MAX 2048
120 char osc_string[OSC_STR_MAX + 1];
123 char id_string[1024];
137 OSC_STRING, OSC_MAYBE_ST,
146 NO_SELECTION, ABOUT_TO, DRAGGING, SELECTED
149 LEXICOGRAPHIC, RECTANGULAR
152 SM_CHAR, SM_WORD, SM_LINE
154 pos selstart, selend, selanchor;
158 wchar_t *paste_buffer;
159 int paste_len, paste_pos, paste_hold;
162 void (*resize_fn)(void *, int, int);
172 #define in_utf(term) ((term)->utf || line_codepage==CP_UTF8)