Lines Matching refs:t
36 teken_tab_isset(const teken_t *t, unsigned int col) in teken_tab_isset() argument
46 return (t->t_tabstops[b] & (1U << o)); in teken_tab_isset()
50 teken_tab_clear(teken_t *t, unsigned int col) in teken_tab_clear() argument
60 t->t_tabstops[b] &= ~(1U << o); in teken_tab_clear()
64 teken_tab_set(teken_t *t, unsigned int col) in teken_tab_set() argument
74 t->t_tabstops[b] |= 1U << o; in teken_tab_set()
78 teken_tab_default(teken_t *t) in teken_tab_default() argument
82 memset(t->t_tabstops, 0, T_NUMCOL / 8); in teken_tab_default()
85 teken_tab_set(t, i); in teken_tab_default()
89 teken_subr_do_scroll(const teken_t *t, int amount) in teken_subr_do_scroll() argument
94 teken_assert(t->t_cursor.tp_row <= t->t_winsize.tp_row); in teken_subr_do_scroll()
95 teken_assert(t->t_scrollreg.ts_end <= t->t_winsize.tp_row); in teken_subr_do_scroll()
103 if (t->t_scrollreg.ts_begin + amount < t->t_scrollreg.ts_end) { in teken_subr_do_scroll()
104 tr.tr_begin.tp_row = t->t_scrollreg.ts_begin + amount; in teken_subr_do_scroll()
106 tr.tr_end.tp_row = t->t_scrollreg.ts_end; in teken_subr_do_scroll()
107 tr.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_do_scroll()
108 tp.tp_row = t->t_scrollreg.ts_begin; in teken_subr_do_scroll()
110 teken_funcs_copy(t, &tr, &tp); in teken_subr_do_scroll()
112 tr.tr_begin.tp_row = t->t_scrollreg.ts_end - amount; in teken_subr_do_scroll()
114 tr.tr_begin.tp_row = t->t_scrollreg.ts_begin; in teken_subr_do_scroll()
119 tr.tr_end.tp_row = t->t_scrollreg.ts_end; in teken_subr_do_scroll()
120 tr.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_do_scroll()
121 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); in teken_subr_do_scroll()
127 if (t->t_scrollreg.ts_begin + amount < t->t_scrollreg.ts_end) { in teken_subr_do_scroll()
128 tr.tr_begin.tp_row = t->t_scrollreg.ts_begin; in teken_subr_do_scroll()
130 tr.tr_end.tp_row = t->t_scrollreg.ts_end - amount; in teken_subr_do_scroll()
131 tr.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_do_scroll()
132 tp.tp_row = t->t_scrollreg.ts_begin + amount; in teken_subr_do_scroll()
134 teken_funcs_copy(t, &tr, &tp); in teken_subr_do_scroll()
136 tr.tr_end.tp_row = t->t_scrollreg.ts_begin + amount; in teken_subr_do_scroll()
138 tr.tr_end.tp_row = t->t_scrollreg.ts_end; in teken_subr_do_scroll()
142 tr.tr_begin.tp_row = t->t_scrollreg.ts_begin; in teken_subr_do_scroll()
144 tr.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_do_scroll()
145 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); in teken_subr_do_scroll()
150 teken_subr_do_cpr(const teken_t *t, unsigned int cmd, char response[16]) in teken_subr_do_cpr() argument
161 (t->t_cursor.tp_row - t->t_originreg.ts_begin) + 1, in teken_subr_do_cpr()
162 t->t_cursor.tp_col + 1); in teken_subr_do_cpr()
184 teken_subr_alignment_test(teken_t *t) in teken_subr_alignment_test() argument
188 t->t_cursor.tp_row = t->t_cursor.tp_col = 0; in teken_subr_alignment_test()
189 t->t_scrollreg.ts_begin = 0; in teken_subr_alignment_test()
190 t->t_scrollreg.ts_end = t->t_winsize.tp_row; in teken_subr_alignment_test()
191 t->t_originreg = t->t_scrollreg; in teken_subr_alignment_test()
192 t->t_stateflags &= ~(TS_WRAPPED|TS_ORIGIN); in teken_subr_alignment_test()
193 teken_funcs_cursor(t); in teken_subr_alignment_test()
197 tr.tr_end = t->t_winsize; in teken_subr_alignment_test()
198 teken_funcs_fill(t, &tr, 'E', &t->t_defattr); in teken_subr_alignment_test()
202 teken_subr_backspace(teken_t *t) in teken_subr_backspace() argument
205 if (t->t_stateflags & TS_CONS25) { in teken_subr_backspace()
206 if (t->t_cursor.tp_col == 0) { in teken_subr_backspace()
207 if (t->t_cursor.tp_row == t->t_originreg.ts_begin) in teken_subr_backspace()
209 t->t_cursor.tp_row--; in teken_subr_backspace()
210 t->t_cursor.tp_col = t->t_winsize.tp_col - 1; in teken_subr_backspace()
212 t->t_cursor.tp_col--; in teken_subr_backspace()
215 if (t->t_cursor.tp_col == 0) in teken_subr_backspace()
218 t->t_cursor.tp_col--; in teken_subr_backspace()
219 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_backspace()
222 teken_funcs_cursor(t); in teken_subr_backspace()
226 teken_subr_bell(const teken_t *t) in teken_subr_bell() argument
229 teken_funcs_bell(t); in teken_subr_bell()
233 teken_subr_carriage_return(teken_t *t) in teken_subr_carriage_return() argument
236 t->t_cursor.tp_col = 0; in teken_subr_carriage_return()
237 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_carriage_return()
238 teken_funcs_cursor(t); in teken_subr_carriage_return()
242 teken_subr_cursor_backward(teken_t *t, unsigned int ncols) in teken_subr_cursor_backward() argument
245 if (ncols > t->t_cursor.tp_col) in teken_subr_cursor_backward()
246 t->t_cursor.tp_col = 0; in teken_subr_cursor_backward()
248 t->t_cursor.tp_col -= ncols; in teken_subr_cursor_backward()
249 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_cursor_backward()
250 teken_funcs_cursor(t); in teken_subr_cursor_backward()
254 teken_subr_cursor_backward_tabulation(teken_t *t, unsigned int ntabs) in teken_subr_cursor_backward_tabulation() argument
259 if (t->t_cursor.tp_col == 0) in teken_subr_cursor_backward_tabulation()
262 t->t_cursor.tp_col--; in teken_subr_cursor_backward_tabulation()
265 if (teken_tab_isset(t, t->t_cursor.tp_col)) in teken_subr_cursor_backward_tabulation()
269 teken_funcs_cursor(t); in teken_subr_cursor_backward_tabulation()
273 teken_subr_cursor_down(teken_t *t, unsigned int nrows) in teken_subr_cursor_down() argument
276 if (t->t_cursor.tp_row + nrows >= t->t_scrollreg.ts_end) in teken_subr_cursor_down()
277 t->t_cursor.tp_row = t->t_scrollreg.ts_end - 1; in teken_subr_cursor_down()
279 t->t_cursor.tp_row += nrows; in teken_subr_cursor_down()
280 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_cursor_down()
281 teken_funcs_cursor(t); in teken_subr_cursor_down()
285 teken_subr_cursor_forward(teken_t *t, unsigned int ncols) in teken_subr_cursor_forward() argument
288 if (t->t_cursor.tp_col + ncols >= t->t_winsize.tp_col) in teken_subr_cursor_forward()
289 t->t_cursor.tp_col = t->t_winsize.tp_col - 1; in teken_subr_cursor_forward()
291 t->t_cursor.tp_col += ncols; in teken_subr_cursor_forward()
292 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_cursor_forward()
293 teken_funcs_cursor(t); in teken_subr_cursor_forward()
297 teken_subr_cursor_forward_tabulation(teken_t *t, unsigned int ntabs) in teken_subr_cursor_forward_tabulation() argument
302 if (t->t_cursor.tp_col == t->t_winsize.tp_col - 1) in teken_subr_cursor_forward_tabulation()
305 t->t_cursor.tp_col++; in teken_subr_cursor_forward_tabulation()
308 if (teken_tab_isset(t, t->t_cursor.tp_col)) in teken_subr_cursor_forward_tabulation()
312 teken_funcs_cursor(t); in teken_subr_cursor_forward_tabulation()
316 teken_subr_cursor_next_line(teken_t *t, unsigned int ncols) in teken_subr_cursor_next_line() argument
319 t->t_cursor.tp_col = 0; in teken_subr_cursor_next_line()
320 teken_subr_cursor_down(t, ncols); in teken_subr_cursor_next_line()
324 teken_subr_cursor_position(teken_t *t, unsigned int row, unsigned int col) in teken_subr_cursor_position() argument
327 row = (row - 1) + t->t_originreg.ts_begin; in teken_subr_cursor_position()
328 t->t_cursor.tp_row = row < t->t_originreg.ts_end ? in teken_subr_cursor_position()
329 row : t->t_originreg.ts_end - 1; in teken_subr_cursor_position()
332 t->t_cursor.tp_col = col < t->t_winsize.tp_col ? in teken_subr_cursor_position()
333 col : t->t_winsize.tp_col - 1; in teken_subr_cursor_position()
335 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_cursor_position()
336 teken_funcs_cursor(t); in teken_subr_cursor_position()
340 teken_subr_cursor_position_report(const teken_t *t, unsigned int cmd) in teken_subr_cursor_position_report() argument
345 len = teken_subr_do_cpr(t, cmd, response + 2); in teken_subr_cursor_position_report()
349 teken_funcs_respond(t, response, len + 2); in teken_subr_cursor_position_report()
353 teken_subr_cursor_previous_line(teken_t *t, unsigned int ncols) in teken_subr_cursor_previous_line() argument
356 t->t_cursor.tp_col = 0; in teken_subr_cursor_previous_line()
357 teken_subr_cursor_up(t, ncols); in teken_subr_cursor_previous_line()
361 teken_subr_cursor_up(teken_t *t, unsigned int nrows) in teken_subr_cursor_up() argument
364 if (t->t_scrollreg.ts_begin + nrows >= t->t_cursor.tp_row) in teken_subr_cursor_up()
365 t->t_cursor.tp_row = t->t_scrollreg.ts_begin; in teken_subr_cursor_up()
367 t->t_cursor.tp_row -= nrows; in teken_subr_cursor_up()
368 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_cursor_up()
369 teken_funcs_cursor(t); in teken_subr_cursor_up()
373 teken_subr_set_cursor_style(teken_t *t __unused, unsigned int style __unused) in teken_subr_set_cursor_style()
392 teken_subr_delete_character(const teken_t *t, unsigned int ncols) in teken_subr_delete_character() argument
396 tr.tr_begin.tp_row = t->t_cursor.tp_row; in teken_subr_delete_character()
397 tr.tr_end.tp_row = t->t_cursor.tp_row + 1; in teken_subr_delete_character()
398 tr.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_delete_character()
400 if (t->t_cursor.tp_col + ncols >= t->t_winsize.tp_col) { in teken_subr_delete_character()
401 tr.tr_begin.tp_col = t->t_cursor.tp_col; in teken_subr_delete_character()
404 tr.tr_begin.tp_col = t->t_cursor.tp_col + ncols; in teken_subr_delete_character()
405 teken_funcs_copy(t, &tr, &t->t_cursor); in teken_subr_delete_character()
407 tr.tr_begin.tp_col = t->t_winsize.tp_col - ncols; in teken_subr_delete_character()
411 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); in teken_subr_delete_character()
415 teken_subr_delete_line(const teken_t *t, unsigned int nrows) in teken_subr_delete_line() argument
420 if (t->t_cursor.tp_row < t->t_scrollreg.ts_begin || in teken_subr_delete_line()
421 t->t_cursor.tp_row >= t->t_scrollreg.ts_end) in teken_subr_delete_line()
425 tr.tr_end.tp_row = t->t_scrollreg.ts_end; in teken_subr_delete_line()
426 tr.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_delete_line()
428 if (t->t_cursor.tp_row + nrows >= t->t_scrollreg.ts_end) { in teken_subr_delete_line()
429 tr.tr_begin.tp_row = t->t_cursor.tp_row; in teken_subr_delete_line()
434 tr.tr_begin.tp_row = t->t_cursor.tp_row + nrows; in teken_subr_delete_line()
435 tp.tp_row = t->t_cursor.tp_row; in teken_subr_delete_line()
437 teken_funcs_copy(t, &tr, &tp); in teken_subr_delete_line()
439 tr.tr_begin.tp_row = t->t_scrollreg.ts_end - nrows; in teken_subr_delete_line()
443 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); in teken_subr_delete_line()
447 teken_subr_device_control_string(teken_t *t) in teken_subr_device_control_string() argument
451 t->t_stateflags |= TS_INSTRING; in teken_subr_device_control_string()
455 teken_subr_device_status_report(const teken_t *t, unsigned int cmd) in teken_subr_device_status_report() argument
460 len = teken_subr_do_cpr(t, cmd, response + 3); in teken_subr_device_status_report()
464 teken_funcs_respond(t, response, len + 3); in teken_subr_device_status_report()
468 teken_subr_double_height_double_width_line_top(const teken_t *t) in teken_subr_double_height_double_width_line_top() argument
471 (void)t; in teken_subr_double_height_double_width_line_top()
476 teken_subr_double_height_double_width_line_bottom(const teken_t *t) in teken_subr_double_height_double_width_line_bottom() argument
479 (void)t; in teken_subr_double_height_double_width_line_bottom()
484 teken_subr_erase_character(const teken_t *t, unsigned int ncols) in teken_subr_erase_character() argument
488 tr.tr_begin = t->t_cursor; in teken_subr_erase_character()
489 tr.tr_end.tp_row = t->t_cursor.tp_row + 1; in teken_subr_erase_character()
491 if (t->t_cursor.tp_col + ncols >= t->t_winsize.tp_col) in teken_subr_erase_character()
492 tr.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_erase_character()
494 tr.tr_end.tp_col = t->t_cursor.tp_col + ncols; in teken_subr_erase_character()
496 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); in teken_subr_erase_character()
500 teken_subr_erase_display(const teken_t *t, unsigned int mode) in teken_subr_erase_display() argument
505 r.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_erase_display()
509 teken_subr_erase_line(t, 1); in teken_subr_erase_display()
512 if (t->t_cursor.tp_row == 0) in teken_subr_erase_display()
515 r.tr_end.tp_row = t->t_cursor.tp_row; in teken_subr_erase_display()
519 r.tr_end.tp_row = t->t_winsize.tp_row; in teken_subr_erase_display()
522 teken_subr_erase_line(t, 0); in teken_subr_erase_display()
525 if (t->t_cursor.tp_row == t->t_winsize.tp_row - 1) in teken_subr_erase_display()
527 r.tr_begin.tp_row = t->t_cursor.tp_row + 1; in teken_subr_erase_display()
528 r.tr_end.tp_row = t->t_winsize.tp_row; in teken_subr_erase_display()
532 teken_funcs_fill(t, &r, BLANK, &t->t_curattr); in teken_subr_erase_display()
536 teken_subr_erase_line(const teken_t *t, unsigned int mode) in teken_subr_erase_line() argument
540 r.tr_begin.tp_row = t->t_cursor.tp_row; in teken_subr_erase_line()
541 r.tr_end.tp_row = t->t_cursor.tp_row + 1; in teken_subr_erase_line()
546 r.tr_end.tp_col = t->t_cursor.tp_col + 1; in teken_subr_erase_line()
550 r.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_erase_line()
553 r.tr_begin.tp_col = t->t_cursor.tp_col; in teken_subr_erase_line()
554 r.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_erase_line()
558 teken_funcs_fill(t, &r, BLANK, &t->t_curattr); in teken_subr_erase_line()
562 teken_subr_g0_scs_special_graphics(teken_t *t) in teken_subr_g0_scs_special_graphics() argument
565 t->t_scs[0] = teken_scs_special_graphics; in teken_subr_g0_scs_special_graphics()
569 teken_subr_g0_scs_uk_national(teken_t *t) in teken_subr_g0_scs_uk_national() argument
572 t->t_scs[0] = teken_scs_uk_national; in teken_subr_g0_scs_uk_national()
576 teken_subr_g0_scs_us_ascii(teken_t *t) in teken_subr_g0_scs_us_ascii() argument
579 t->t_scs[0] = teken_scs_us_ascii; in teken_subr_g0_scs_us_ascii()
583 teken_subr_g1_scs_special_graphics(teken_t *t) in teken_subr_g1_scs_special_graphics() argument
586 t->t_scs[1] = teken_scs_special_graphics; in teken_subr_g1_scs_special_graphics()
590 teken_subr_g1_scs_uk_national(teken_t *t) in teken_subr_g1_scs_uk_national() argument
593 t->t_scs[1] = teken_scs_uk_national; in teken_subr_g1_scs_uk_national()
597 teken_subr_g1_scs_us_ascii(teken_t *t) in teken_subr_g1_scs_us_ascii() argument
600 t->t_scs[1] = teken_scs_us_ascii; in teken_subr_g1_scs_us_ascii()
604 teken_subr_horizontal_position_absolute(teken_t *t, unsigned int col) in teken_subr_horizontal_position_absolute() argument
608 t->t_cursor.tp_col = col < t->t_winsize.tp_col ? in teken_subr_horizontal_position_absolute()
609 col : t->t_winsize.tp_col - 1; in teken_subr_horizontal_position_absolute()
611 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_horizontal_position_absolute()
612 teken_funcs_cursor(t); in teken_subr_horizontal_position_absolute()
616 teken_subr_horizontal_tab(teken_t *t) in teken_subr_horizontal_tab() argument
619 teken_subr_cursor_forward_tabulation(t, 1); in teken_subr_horizontal_tab()
623 teken_subr_horizontal_tab_set(teken_t *t) in teken_subr_horizontal_tab_set() argument
626 teken_tab_set(t, t->t_cursor.tp_col); in teken_subr_horizontal_tab_set()
630 teken_subr_index(teken_t *t) in teken_subr_index() argument
633 if (t->t_cursor.tp_row < t->t_scrollreg.ts_end - 1) { in teken_subr_index()
634 t->t_cursor.tp_row++; in teken_subr_index()
635 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_index()
636 teken_funcs_cursor(t); in teken_subr_index()
638 teken_subr_do_scroll(t, 1); in teken_subr_index()
643 teken_subr_insert_character(const teken_t *t, unsigned int ncols) in teken_subr_insert_character() argument
647 tr.tr_begin = t->t_cursor; in teken_subr_insert_character()
648 tr.tr_end.tp_row = t->t_cursor.tp_row + 1; in teken_subr_insert_character()
650 if (t->t_cursor.tp_col + ncols >= t->t_winsize.tp_col) { in teken_subr_insert_character()
651 tr.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_insert_character()
656 tr.tr_end.tp_col = t->t_winsize.tp_col - ncols; in teken_subr_insert_character()
657 tp.tp_row = t->t_cursor.tp_row; in teken_subr_insert_character()
658 tp.tp_col = t->t_cursor.tp_col + ncols; in teken_subr_insert_character()
659 teken_funcs_copy(t, &tr, &tp); in teken_subr_insert_character()
661 tr.tr_end.tp_col = t->t_cursor.tp_col + ncols; in teken_subr_insert_character()
665 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); in teken_subr_insert_character()
669 teken_subr_insert_line(const teken_t *t, unsigned int nrows) in teken_subr_insert_line() argument
674 if (t->t_cursor.tp_row < t->t_scrollreg.ts_begin || in teken_subr_insert_line()
675 t->t_cursor.tp_row >= t->t_scrollreg.ts_end) in teken_subr_insert_line()
678 tr.tr_begin.tp_row = t->t_cursor.tp_row; in teken_subr_insert_line()
680 tr.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_insert_line()
682 if (t->t_cursor.tp_row + nrows >= t->t_scrollreg.ts_end) { in teken_subr_insert_line()
683 tr.tr_end.tp_row = t->t_scrollreg.ts_end; in teken_subr_insert_line()
688 tr.tr_end.tp_row = t->t_scrollreg.ts_end - nrows; in teken_subr_insert_line()
689 tp.tp_row = t->t_cursor.tp_row + nrows; in teken_subr_insert_line()
691 teken_funcs_copy(t, &tr, &tp); in teken_subr_insert_line()
693 tr.tr_end.tp_row = t->t_cursor.tp_row + nrows; in teken_subr_insert_line()
697 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); in teken_subr_insert_line()
701 teken_subr_keypad_application_mode(const teken_t *t) in teken_subr_keypad_application_mode() argument
704 teken_funcs_param(t, TP_KEYPADAPP, 1); in teken_subr_keypad_application_mode()
708 teken_subr_keypad_numeric_mode(const teken_t *t) in teken_subr_keypad_numeric_mode() argument
711 teken_funcs_param(t, TP_KEYPADAPP, 0); in teken_subr_keypad_numeric_mode()
715 teken_subr_newline(teken_t *t) in teken_subr_newline() argument
718 t->t_cursor.tp_row++; in teken_subr_newline()
720 if (t->t_cursor.tp_row >= t->t_scrollreg.ts_end) { in teken_subr_newline()
721 teken_subr_do_scroll(t, 1); in teken_subr_newline()
722 t->t_cursor.tp_row = t->t_scrollreg.ts_end - 1; in teken_subr_newline()
725 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_newline()
726 teken_funcs_cursor(t); in teken_subr_newline()
730 teken_subr_newpage(teken_t *t) in teken_subr_newpage() argument
733 if (t->t_stateflags & TS_CONS25) { in teken_subr_newpage()
737 tr.tr_begin.tp_row = t->t_originreg.ts_begin; in teken_subr_newpage()
739 tr.tr_end.tp_row = t->t_originreg.ts_end; in teken_subr_newpage()
740 tr.tr_end.tp_col = t->t_winsize.tp_col; in teken_subr_newpage()
741 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); in teken_subr_newpage()
744 t->t_cursor.tp_row = t->t_originreg.ts_begin; in teken_subr_newpage()
745 t->t_cursor.tp_col = 0; in teken_subr_newpage()
746 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_newpage()
747 teken_funcs_cursor(t); in teken_subr_newpage()
749 teken_subr_newline(t); in teken_subr_newpage()
754 teken_subr_next_line(teken_t *t) in teken_subr_next_line() argument
757 t->t_cursor.tp_col = 0; in teken_subr_next_line()
758 teken_subr_newline(t); in teken_subr_next_line()
762 teken_subr_operating_system_command(teken_t *t) in teken_subr_operating_system_command() argument
766 t->t_stateflags |= TS_INSTRING; in teken_subr_operating_system_command()
770 teken_subr_pan_down(const teken_t *t, unsigned int nrows) in teken_subr_pan_down() argument
773 teken_subr_do_scroll(t, (int)nrows); in teken_subr_pan_down()
777 teken_subr_pan_up(const teken_t *t, unsigned int nrows) in teken_subr_pan_up() argument
780 teken_subr_do_scroll(t, -(int)nrows); in teken_subr_pan_up()
784 teken_subr_primary_device_attributes(const teken_t *t, unsigned int request) in teken_subr_primary_device_attributes() argument
790 teken_funcs_respond(t, response, sizeof response - 1); in teken_subr_primary_device_attributes()
797 teken_subr_do_putchar(teken_t *t, const teken_pos_t *tp, teken_char_t c, in teken_subr_do_putchar() argument
801 t->t_last = c; in teken_subr_do_putchar()
802 if (t->t_stateflags & TS_INSERT && in teken_subr_do_putchar()
803 tp->tp_col < t->t_winsize.tp_col - width) { in teken_subr_do_putchar()
810 ctr.tr_end.tp_col = t->t_winsize.tp_col - width; in teken_subr_do_putchar()
813 teken_funcs_copy(t, &ctr, &ctp); in teken_subr_do_putchar()
816 teken_funcs_putchar(t, tp, c, &t->t_curattr); in teken_subr_do_putchar()
818 if (width == 2 && tp->tp_col + 1 < t->t_winsize.tp_col) { in teken_subr_do_putchar()
825 attr = t->t_curattr; in teken_subr_do_putchar()
827 teken_funcs_putchar(t, &tp2, c, &attr); in teken_subr_do_putchar()
832 teken_subr_regular_character(teken_t *t, teken_char_t c) in teken_subr_regular_character() argument
836 if (t->t_stateflags & TS_8BIT) { in teken_subr_regular_character()
837 if (!(t->t_stateflags & TS_CONS25) && (c <= 0x1b || c == 0x7f)) in teken_subr_regular_character()
839 c = teken_scs_process(t, c); in teken_subr_regular_character()
842 c = teken_scs_process(t, c); in teken_subr_regular_character()
849 if (t->t_stateflags & TS_CONS25) { in teken_subr_regular_character()
850 teken_subr_do_putchar(t, &t->t_cursor, c, width); in teken_subr_regular_character()
851 t->t_cursor.tp_col += width; in teken_subr_regular_character()
853 if (t->t_cursor.tp_col >= t->t_winsize.tp_col) { in teken_subr_regular_character()
854 if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) { in teken_subr_regular_character()
856 teken_subr_do_scroll(t, 1); in teken_subr_regular_character()
859 if (t->t_cursor.tp_row < in teken_subr_regular_character()
860 t->t_winsize.tp_row - 1) in teken_subr_regular_character()
861 t->t_cursor.tp_row++; in teken_subr_regular_character()
863 t->t_cursor.tp_col = 0; in teken_subr_regular_character()
865 } else if (t->t_stateflags & TS_AUTOWRAP && in teken_subr_regular_character()
866 ((t->t_stateflags & TS_WRAPPED && in teken_subr_regular_character()
867 t->t_cursor.tp_col + 1 == t->t_winsize.tp_col) || in teken_subr_regular_character()
868 t->t_cursor.tp_col + width > t->t_winsize.tp_col)) { in teken_subr_regular_character()
877 if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) { in teken_subr_regular_character()
879 teken_subr_do_scroll(t, 1); in teken_subr_regular_character()
880 tp.tp_row = t->t_scrollreg.ts_end - 1; in teken_subr_regular_character()
883 tp.tp_row = t->t_cursor.tp_row + 1; in teken_subr_regular_character()
884 if (tp.tp_row == t->t_winsize.tp_row) { in teken_subr_regular_character()
890 teken_subr_do_putchar(t, &t->t_cursor, in teken_subr_regular_character()
897 teken_subr_do_putchar(t, &tp, c, width); in teken_subr_regular_character()
899 t->t_cursor.tp_row = tp.tp_row; in teken_subr_regular_character()
900 t->t_cursor.tp_col = width; in teken_subr_regular_character()
901 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_regular_character()
904 teken_subr_do_putchar(t, &t->t_cursor, c, width); in teken_subr_regular_character()
905 t->t_cursor.tp_col += width; in teken_subr_regular_character()
907 if (t->t_cursor.tp_col >= t->t_winsize.tp_col) { in teken_subr_regular_character()
908 t->t_stateflags |= TS_WRAPPED; in teken_subr_regular_character()
909 t->t_cursor.tp_col = t->t_winsize.tp_col - 1; in teken_subr_regular_character()
911 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_regular_character()
915 teken_funcs_cursor(t); in teken_subr_regular_character()
919 teken_subr_reset_dec_mode(teken_t *t, unsigned int cmd) in teken_subr_reset_dec_mode() argument
924 t->t_stateflags &= ~TS_CURSORKEYS; in teken_subr_reset_dec_mode()
930 teken_funcs_param(t, TP_132COLS, 0); in teken_subr_reset_dec_mode()
931 teken_subr_reset_to_initial_state(t); in teken_subr_reset_dec_mode()
937 t->t_stateflags &= ~TS_ORIGIN; in teken_subr_reset_dec_mode()
938 t->t_originreg.ts_begin = 0; in teken_subr_reset_dec_mode()
939 t->t_originreg.ts_end = t->t_winsize.tp_row; in teken_subr_reset_dec_mode()
940 t->t_cursor.tp_row = t->t_cursor.tp_col = 0; in teken_subr_reset_dec_mode()
941 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_reset_dec_mode()
942 teken_funcs_cursor(t); in teken_subr_reset_dec_mode()
945 t->t_stateflags &= ~TS_AUTOWRAP; in teken_subr_reset_dec_mode()
948 teken_funcs_param(t, TP_AUTOREPEAT, 0); in teken_subr_reset_dec_mode()
951 teken_funcs_param(t, TP_SHOWCURSOR, 0); in teken_subr_reset_dec_mode()
963 teken_funcs_param(t, TP_MOUSE, 0); in teken_subr_reset_dec_mode()
971 teken_subr_reset_mode(teken_t *t, unsigned int cmd) in teken_subr_reset_mode() argument
976 t->t_stateflags &= ~TS_INSERT; in teken_subr_reset_mode()
984 teken_subr_do_resize(teken_t *t) in teken_subr_do_resize() argument
987 t->t_scrollreg.ts_begin = 0; in teken_subr_do_resize()
988 t->t_scrollreg.ts_end = t->t_winsize.tp_row; in teken_subr_do_resize()
989 t->t_originreg = t->t_scrollreg; in teken_subr_do_resize()
993 teken_subr_do_reset(teken_t *t) in teken_subr_do_reset() argument
996 t->t_curattr = t->t_defattr; in teken_subr_do_reset()
997 t->t_cursor.tp_row = t->t_cursor.tp_col = 0; in teken_subr_do_reset()
998 t->t_scrollreg.ts_begin = 0; in teken_subr_do_reset()
999 t->t_scrollreg.ts_end = t->t_winsize.tp_row; in teken_subr_do_reset()
1000 t->t_originreg = t->t_scrollreg; in teken_subr_do_reset()
1001 t->t_stateflags &= TS_8BIT | TS_CONS25 | TS_CONS25KEYS; in teken_subr_do_reset()
1002 t->t_stateflags |= TS_AUTOWRAP; in teken_subr_do_reset()
1004 t->t_scs[0] = teken_scs_us_ascii; in teken_subr_do_reset()
1005 t->t_scs[1] = teken_scs_us_ascii; in teken_subr_do_reset()
1006 t->t_curscs = 0; in teken_subr_do_reset()
1008 teken_subr_save_cursor(t); in teken_subr_do_reset()
1009 teken_tab_default(t); in teken_subr_do_reset()
1013 teken_subr_reset_to_initial_state(teken_t *t) in teken_subr_reset_to_initial_state() argument
1016 teken_subr_do_reset(t); in teken_subr_reset_to_initial_state()
1017 teken_subr_erase_display(t, 2); in teken_subr_reset_to_initial_state()
1018 teken_funcs_param(t, TP_SHOWCURSOR, 1); in teken_subr_reset_to_initial_state()
1019 teken_funcs_cursor(t); in teken_subr_reset_to_initial_state()
1023 teken_subr_restore_cursor(teken_t *t) in teken_subr_restore_cursor() argument
1026 t->t_cursor = t->t_saved_cursor; in teken_subr_restore_cursor()
1027 t->t_curattr = t->t_saved_curattr; in teken_subr_restore_cursor()
1028 t->t_scs[t->t_curscs] = t->t_saved_curscs; in teken_subr_restore_cursor()
1029 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_restore_cursor()
1032 if (t->t_cursor.tp_row < t->t_originreg.ts_begin || in teken_subr_restore_cursor()
1033 t->t_cursor.tp_row >= t->t_originreg.ts_end) { in teken_subr_restore_cursor()
1034 t->t_stateflags &= ~TS_ORIGIN; in teken_subr_restore_cursor()
1035 t->t_originreg.ts_begin = 0; in teken_subr_restore_cursor()
1036 t->t_originreg.ts_end = t->t_winsize.tp_row; in teken_subr_restore_cursor()
1039 teken_funcs_cursor(t); in teken_subr_restore_cursor()
1043 teken_subr_reverse_index(teken_t *t) in teken_subr_reverse_index() argument
1046 if (t->t_cursor.tp_row > t->t_scrollreg.ts_begin) { in teken_subr_reverse_index()
1047 t->t_cursor.tp_row--; in teken_subr_reverse_index()
1048 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_reverse_index()
1049 teken_funcs_cursor(t); in teken_subr_reverse_index()
1051 teken_subr_do_scroll(t, -1); in teken_subr_reverse_index()
1056 teken_subr_save_cursor(teken_t *t) in teken_subr_save_cursor() argument
1059 t->t_saved_cursor = t->t_cursor; in teken_subr_save_cursor()
1060 t->t_saved_curattr = t->t_curattr; in teken_subr_save_cursor()
1061 t->t_saved_curscs = t->t_scs[t->t_curscs]; in teken_subr_save_cursor()
1065 teken_subr_secondary_device_attributes(const teken_t *t, unsigned int request) in teken_subr_secondary_device_attributes() argument
1070 teken_funcs_respond(t, response, sizeof response - 1); in teken_subr_secondary_device_attributes()
1077 teken_subr_set_dec_mode(teken_t *t, unsigned int cmd) in teken_subr_set_dec_mode() argument
1082 t->t_stateflags |= TS_CURSORKEYS; in teken_subr_set_dec_mode()
1088 teken_funcs_param(t, TP_132COLS, 1); in teken_subr_set_dec_mode()
1089 teken_subr_reset_to_initial_state(t); in teken_subr_set_dec_mode()
1095 t->t_stateflags |= TS_ORIGIN; in teken_subr_set_dec_mode()
1096 t->t_originreg = t->t_scrollreg; in teken_subr_set_dec_mode()
1097 t->t_cursor.tp_row = t->t_scrollreg.ts_begin; in teken_subr_set_dec_mode()
1098 t->t_cursor.tp_col = 0; in teken_subr_set_dec_mode()
1099 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_set_dec_mode()
1100 teken_funcs_cursor(t); in teken_subr_set_dec_mode()
1103 t->t_stateflags |= TS_AUTOWRAP; in teken_subr_set_dec_mode()
1106 teken_funcs_param(t, TP_AUTOREPEAT, 1); in teken_subr_set_dec_mode()
1109 teken_funcs_param(t, TP_SHOWCURSOR, 1); in teken_subr_set_dec_mode()
1121 teken_funcs_param(t, TP_MOUSE, 1); in teken_subr_set_dec_mode()
1129 teken_subr_set_mode(teken_t *t, unsigned int cmd) in teken_subr_set_mode() argument
1135 t->t_stateflags |= TS_INSERT; in teken_subr_set_mode()
1143 teken_subr_set_graphic_rendition(teken_t *t, unsigned int ncmds, in teken_subr_set_graphic_rendition() argument
1150 t->t_curattr = t->t_defattr; in teken_subr_set_graphic_rendition()
1159 t->t_curattr = t->t_defattr; in teken_subr_set_graphic_rendition()
1162 t->t_curattr.ta_format |= TF_BOLD; in teken_subr_set_graphic_rendition()
1165 t->t_curattr.ta_format |= TF_UNDERLINE; in teken_subr_set_graphic_rendition()
1168 t->t_curattr.ta_format |= TF_BLINK; in teken_subr_set_graphic_rendition()
1171 t->t_curattr.ta_format |= TF_REVERSE; in teken_subr_set_graphic_rendition()
1174 t->t_curattr.ta_format &= ~TF_BOLD; in teken_subr_set_graphic_rendition()
1177 t->t_curattr.ta_format &= ~TF_UNDERLINE; in teken_subr_set_graphic_rendition()
1180 t->t_curattr.ta_format &= ~TF_BLINK; in teken_subr_set_graphic_rendition()
1183 t->t_curattr.ta_format &= ~TF_REVERSE; in teken_subr_set_graphic_rendition()
1193 t->t_curattr.ta_fgcolor = n - 30; in teken_subr_set_graphic_rendition()
1198 t->t_curattr.ta_fgcolor = cmds[i + 2]; in teken_subr_set_graphic_rendition()
1202 t->t_curattr.ta_fgcolor = t->t_defattr.ta_fgcolor; in teken_subr_set_graphic_rendition()
1212 t->t_curattr.ta_bgcolor = n - 40; in teken_subr_set_graphic_rendition()
1217 t->t_curattr.ta_bgcolor = cmds[i + 2]; in teken_subr_set_graphic_rendition()
1221 t->t_curattr.ta_bgcolor = t->t_defattr.ta_bgcolor; in teken_subr_set_graphic_rendition()
1231 t->t_curattr.ta_fgcolor = (n - 90) + 8; in teken_subr_set_graphic_rendition()
1241 t->t_curattr.ta_bgcolor = (n - 100) + 8; in teken_subr_set_graphic_rendition()
1250 teken_subr_set_top_and_bottom_margins(teken_t *t, unsigned int top, in teken_subr_set_top_and_bottom_margins() argument
1258 if (bottom == 0 || bottom > t->t_winsize.tp_row) in teken_subr_set_top_and_bottom_margins()
1259 bottom = t->t_winsize.tp_row; in teken_subr_set_top_and_bottom_margins()
1264 bottom = t->t_winsize.tp_row; in teken_subr_set_top_and_bottom_margins()
1268 t->t_scrollreg.ts_begin = top; in teken_subr_set_top_and_bottom_margins()
1269 t->t_scrollreg.ts_end = bottom; in teken_subr_set_top_and_bottom_margins()
1270 if (t->t_stateflags & TS_ORIGIN) in teken_subr_set_top_and_bottom_margins()
1271 t->t_originreg = t->t_scrollreg; in teken_subr_set_top_and_bottom_margins()
1274 t->t_cursor.tp_row = t->t_originreg.ts_begin; in teken_subr_set_top_and_bottom_margins()
1275 t->t_cursor.tp_col = 0; in teken_subr_set_top_and_bottom_margins()
1276 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_set_top_and_bottom_margins()
1277 teken_funcs_cursor(t); in teken_subr_set_top_and_bottom_margins()
1281 teken_subr_single_height_double_width_line(const teken_t *t) in teken_subr_single_height_double_width_line() argument
1284 (void)t; in teken_subr_single_height_double_width_line()
1289 teken_subr_single_height_single_width_line(const teken_t *t) in teken_subr_single_height_single_width_line() argument
1292 (void)t; in teken_subr_single_height_single_width_line()
1297 teken_subr_string_terminator(const teken_t *t) in teken_subr_string_terminator() argument
1300 (void)t; in teken_subr_string_terminator()
1308 teken_subr_tab_clear(teken_t *t, unsigned int cmd) in teken_subr_tab_clear() argument
1313 teken_tab_clear(t, t->t_cursor.tp_col); in teken_subr_tab_clear()
1316 memset(t->t_tabstops, 0, T_NUMCOL / 8); in teken_subr_tab_clear()
1324 teken_subr_vertical_position_absolute(teken_t *t, unsigned int row) in teken_subr_vertical_position_absolute() argument
1327 row = (row - 1) + t->t_originreg.ts_begin; in teken_subr_vertical_position_absolute()
1328 t->t_cursor.tp_row = row < t->t_originreg.ts_end ? in teken_subr_vertical_position_absolute()
1329 row : t->t_originreg.ts_end - 1; in teken_subr_vertical_position_absolute()
1331 t->t_stateflags &= ~TS_WRAPPED; in teken_subr_vertical_position_absolute()
1332 teken_funcs_cursor(t); in teken_subr_vertical_position_absolute()
1336 teken_subr_repeat_last_graphic_char(teken_t *t, unsigned int rpts) in teken_subr_repeat_last_graphic_char() argument
1340 max_repetitions = t->t_winsize.tp_row * t->t_winsize.tp_col; in teken_subr_repeat_last_graphic_char()
1343 for (; t->t_last != 0 && rpts > 0; rpts--) in teken_subr_repeat_last_graphic_char()
1344 teken_subr_regular_character(t, t->t_last); in teken_subr_repeat_last_graphic_char()