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;
23 #ifdef OPTIMISE_SCROLL
25 struct scrollregion *next;
26 int topline; /* Top line of scroll region. */
27 int botline; /* Bottom line of scroll region. */
28 int lines; /* Number of lines to scroll by - +ve is forwards. */
30 #endif /* OPTIMISE_SCROLL */
34 int compatibility_level;
36 tree234 *scrollback; /* lines scrolled off top of screen */
37 tree234 *screen; /* lines on primary screen */
38 tree234 *alt_screen; /* lines on alternate screen */
39 int disptop; /* distance scrolled back (0 or -ve) */
40 int tempsblines; /* number of lines in temporary
43 unsigned long *cpos; /* cursor position (convenience) */
45 unsigned long *disptext; /* buffer of text on real screen */
46 unsigned long *dispcurs; /* location of cursor on real screen */
47 unsigned long curstype; /* type of cursor on real screen */
49 #define VBELL_TIMEOUT (TICKSPERSEC/10) /* visual bell lasts 1/10 sec */
51 struct beeptime *beephead, *beeptail;
56 #define TSIZE (sizeof(unsigned long))
57 #define fix_cpos do { \
58 term->cpos = lineptr(term->curs.y) + term->curs.x; \
61 #ifdef OPTIMISE_SCROLL
62 struct scrollregion *scrollhead, *scrolltail;
63 #endif /* OPTIMISE_SCROLL */
65 unsigned long curr_attr, save_attr;
66 unsigned long erase_char;
68 bufchain inbuf; /* terminal input buffer */
69 pos curs; /* cursor */
70 pos savecurs; /* saved cursor position */
71 int marg_t, marg_b; /* scroll margins */
72 int dec_om; /* DEC origin mode flag */
73 int wrap, wrapnext; /* wrap flags */
74 int insert; /* insert-mode flag */
75 int cset; /* 0 or 1: which char set */
76 int save_cset, save_csattr; /* saved with cursor position */
77 int save_utf, save_wnext; /* saved with cursor position */
78 int rvideo; /* global reverse video flag */
79 unsigned long rvbell_startpoint; /* for ESC[?5hESC[?5l vbell */
80 int cursor_on; /* cursor enabled flag */
81 int reset_132; /* Flag ESC c resets to 80 cols */
82 int use_bce; /* Use Background coloured erase */
83 int blinker; /* When blinking is the cursor on ? */
84 int tblinker; /* When the blinking text is on */
85 int blink_is_real; /* Actually blink blinking text */
86 int term_echoing; /* Does terminal want local echo? */
87 int term_editing; /* Does terminal want local edit? */
88 int sco_acs, save_sco_acs; /* CSI 10,11,12m -> OEM charset */
89 int vt52_bold; /* Force bold on non-bold colours */
90 int utf; /* Are we in toggleable UTF-8 mode? */
91 int utf_state; /* Is there a pending UTF-8 character */
92 int utf_char; /* and what is it so far. */
93 int utf_size; /* The size of the UTF character. */
94 int printing, only_printing; /* Are we doing ANSI printing? */
95 int print_state; /* state of print-end-sequence scan */
96 bufchain printer_buf; /* buffered data for printer */
97 printer_job *print_job;
99 int rows, cols, savelines;
102 unsigned long vbell_startpoint;
103 int app_cursor_keys, app_keypad_keys, vt52_mode;
104 int repeat_off, cr_lf_return;
108 long last_blink; /* used for real blinking control */
111 int xterm_mouse; /* send mouse messages to app */
112 int mouse_is_down; /* used while tracking mouse buttons */
114 unsigned long cset_attr[2];
117 * Saved settings on the alternate screen.
119 int alt_x, alt_y, alt_om, alt_wrap, alt_wnext, alt_ins;
120 int alt_cset, alt_sco_acs, alt_utf;
123 int alt_sblines; /* # of lines on alternate screen that should be used for scrollback. */
125 #define ARGS_MAX 32 /* max # of esc sequence arguments */
126 #define ARG_DEFAULT 0 /* if an arg isn't specified */
127 #define def(a,d) ( (a) == ARG_DEFAULT ? (d) : (a) )
128 int esc_args[ARGS_MAX];
131 #define ANSI(x,y) ((x)+((y)<<8))
132 #define ANSI_QUE(x) ANSI(x,TRUE)
134 #define OSC_STR_MAX 2048
136 char osc_string[OSC_STR_MAX + 1];
139 char id_string[1024];
153 OSC_STRING, OSC_MAYBE_ST,
162 NO_SELECTION, ABOUT_TO, DRAGGING, SELECTED
165 LEXICOGRAPHIC, RECTANGULAR
168 SM_CHAR, SM_WORD, SM_LINE
170 pos selstart, selend, selanchor;
174 /* Mask of attributes to pay attention to when painting. */
175 unsigned long attr_mask;
177 wchar_t *paste_buffer;
178 int paste_len, paste_pos, paste_hold;
181 void (*resize_fn)(void *, int, int);
190 struct unicode_data *ucsdata;
193 * We maintain a full _copy_ of a Config structure here, not
194 * merely a pointer to it. That way, when we're passed a new
195 * one for reconfiguration, we can check the differences and
196 * adjust the _current_ setting of (e.g.) auto wrap mode rather
197 * than only the default.
202 #define in_utf(term) ((term)->utf || (term)->ucsdata->line_codepage==CP_UTF8)