teken_subr.h (186798) | teken_subr.h (187367) |
---|---|
1/*- 2 * Copyright (c) 2008-2009 Ed Schouten <ed@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2008-2009 Ed Schouten <ed@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/syscons/teken/teken_subr.h 186798 2009-01-05 22:09:46Z ed $ | 26 * $FreeBSD: head/sys/dev/syscons/teken/teken_subr.h 187367 2009-01-17 16:37:13Z ed $ |
27 */ 28 29static void teken_subr_cursor_up(teken_t *, unsigned int); 30static void teken_subr_erase_line(teken_t *, unsigned int); 31static void teken_subr_regular_character(teken_t *, teken_char_t); 32static void teken_subr_reset_to_initial_state(teken_t *); 33 34static inline int --- 158 unchanged lines hidden (view full) --- 193 tr.tr_end = t->t_winsize; 194 teken_funcs_fill(t, &tr, 'E', &t->t_defattr); 195} 196 197static void 198teken_subr_backspace(teken_t *t) 199{ 200 | 27 */ 28 29static void teken_subr_cursor_up(teken_t *, unsigned int); 30static void teken_subr_erase_line(teken_t *, unsigned int); 31static void teken_subr_regular_character(teken_t *, teken_char_t); 32static void teken_subr_reset_to_initial_state(teken_t *); 33 34static inline int --- 158 unchanged lines hidden (view full) --- 193 tr.tr_end = t->t_winsize; 194 teken_funcs_fill(t, &tr, 'E', &t->t_defattr); 195} 196 197static void 198teken_subr_backspace(teken_t *t) 199{ 200 |
201#ifdef TEKEN_CONS25 | 201#ifdef TEKEN_XTERM 202 if (t->t_cursor.tp_col == 0) 203 return; 204 205 t->t_cursor.tp_col--; 206 t->t_stateflags &= ~TS_WRAPPED; 207#else /* !TEKEN_XTERM */ |
202 if (t->t_cursor.tp_col == 0) { 203 if (t->t_cursor.tp_row == t->t_originreg.ts_begin) 204 return; 205 t->t_cursor.tp_row--; 206 t->t_cursor.tp_col = t->t_winsize.tp_col - 1; 207 } else { 208 t->t_cursor.tp_col--; 209 } | 208 if (t->t_cursor.tp_col == 0) { 209 if (t->t_cursor.tp_row == t->t_originreg.ts_begin) 210 return; 211 t->t_cursor.tp_row--; 212 t->t_cursor.tp_col = t->t_winsize.tp_col - 1; 213 } else { 214 t->t_cursor.tp_col--; 215 } |
210#else /* !TEKEN_CONS25 */ 211 if (t->t_cursor.tp_col == 0) 212 return; | 216#endif /* TEKEN_XTERM */ |
213 | 217 |
214 t->t_cursor.tp_col--; 215 t->t_stateflags &= ~TS_WRAPPED; 216#endif /* TEKEN_CONS25 */ 217 | |
218 teken_funcs_cursor(t); 219} 220 221static void 222teken_subr_bell(teken_t *t) 223{ 224 225 teken_funcs_bell(t); --- 311 unchanged lines hidden (view full) --- 537 538 t->t_stateflags &= ~TS_WRAPPED; 539 teken_funcs_cursor(t); 540} 541 542static void 543teken_subr_horizontal_tab(teken_t *t) 544{ | 218 teken_funcs_cursor(t); 219} 220 221static void 222teken_subr_bell(teken_t *t) 223{ 224 225 teken_funcs_bell(t); --- 311 unchanged lines hidden (view full) --- 537 538 t->t_stateflags &= ~TS_WRAPPED; 539 teken_funcs_cursor(t); 540} 541 542static void 543teken_subr_horizontal_tab(teken_t *t) 544{ |
545#ifdef TEKEN_CONS25 546 547 teken_subr_cursor_forward_tabulation(t, 1); 548#else /* !TEKEN_CONS25 */ | 545#ifdef TEKEN_XTERM |
549 teken_rect_t tr; 550 551 tr.tr_begin = t->t_cursor; 552 teken_subr_cursor_forward_tabulation(t, 1); 553 tr.tr_end.tp_row = tr.tr_begin.tp_row + 1; 554 tr.tr_end.tp_col = t->t_cursor.tp_col; 555 556 /* Blank region that we skipped. */ 557 if (tr.tr_end.tp_col > tr.tr_begin.tp_col) 558 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); | 546 teken_rect_t tr; 547 548 tr.tr_begin = t->t_cursor; 549 teken_subr_cursor_forward_tabulation(t, 1); 550 tr.tr_end.tp_row = tr.tr_begin.tp_row + 1; 551 tr.tr_end.tp_col = t->t_cursor.tp_col; 552 553 /* Blank region that we skipped. */ 554 if (tr.tr_end.tp_col > tr.tr_begin.tp_col) 555 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); |
559#endif /* TEKEN_CONS25 */ | 556#else /* !TEKEN_XTERM */ 557 558 teken_subr_cursor_forward_tabulation(t, 1); 559#endif /* TEKEN_XTERM */ |
560} 561 562static void 563teken_subr_horizontal_tab_set(teken_t *t) 564{ 565 566 teken_tab_set(t, t->t_cursor.tp_col); 567} --- 91 unchanged lines hidden (view full) --- 659 660 t->t_stateflags &= ~TS_WRAPPED; 661 teken_funcs_cursor(t); 662} 663 664static void 665teken_subr_newpage(teken_t *t) 666{ | 560} 561 562static void 563teken_subr_horizontal_tab_set(teken_t *t) 564{ 565 566 teken_tab_set(t, t->t_cursor.tp_col); 567} --- 91 unchanged lines hidden (view full) --- 659 660 t->t_stateflags &= ~TS_WRAPPED; 661 teken_funcs_cursor(t); 662} 663 664static void 665teken_subr_newpage(teken_t *t) 666{ |
667#ifdef TEKEN_CONS25 | 667#ifdef TEKEN_XTERM 668 669 teken_subr_newline(t); 670#else /* !TEKEN_XTERM */ |
668 teken_rect_t tr; 669 670 tr.tr_begin.tp_row = tr.tr_begin.tp_col = 0; 671 tr.tr_end = t->t_winsize; 672 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); 673 674 t->t_cursor.tp_row = t->t_cursor.tp_col = 0; 675 teken_funcs_cursor(t); | 671 teken_rect_t tr; 672 673 tr.tr_begin.tp_row = tr.tr_begin.tp_col = 0; 674 tr.tr_end = t->t_winsize; 675 teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); 676 677 t->t_cursor.tp_row = t->t_cursor.tp_col = 0; 678 teken_funcs_cursor(t); |
676#else /* !TEKEN_CONS25 */ 677 678 teken_subr_newline(t); 679#endif /* TEKEN_CONS25 */ | 679#endif /* TEKEN_XTERM */ |
680} 681 682static void 683teken_subr_next_line(teken_t *t) 684{ 685 686 t->t_cursor.tp_col = 0; 687 teken_subr_newline(t); --- 53 unchanged lines hidden (view full) --- 741{ 742 int width; 743 744 /* XXX: Don't process zero-width characters yet. */ 745 width = teken_wcwidth(c); 746 if (width <= 0) 747 return; 748 | 680} 681 682static void 683teken_subr_next_line(teken_t *t) 684{ 685 686 t->t_cursor.tp_col = 0; 687 teken_subr_newline(t); --- 53 unchanged lines hidden (view full) --- 741{ 742 int width; 743 744 /* XXX: Don't process zero-width characters yet. */ 745 width = teken_wcwidth(c); 746 if (width <= 0) 747 return; 748 |
749#ifdef TEKEN_CONS25 750 teken_subr_do_putchar(t, &t->t_cursor, c, width); 751 t->t_cursor.tp_col += width; 752 753 if (t->t_cursor.tp_col >= t->t_winsize.tp_col) { 754 if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) { 755 /* Perform scrolling. */ 756 teken_subr_do_scroll(t, 1); 757 } else { 758 /* No scrolling needed. */ 759 if (t->t_cursor.tp_row < t->t_winsize.tp_row - 1) 760 t->t_cursor.tp_row++; 761 } 762 t->t_cursor.tp_col = 0; 763 } 764#else /* !TEKEN_CONS25 */ | 749#ifdef TEKEN_XTERM |
765 if (t->t_cursor.tp_col == t->t_winsize.tp_col - 1 && 766 (t->t_stateflags & (TS_WRAPPED|TS_AUTOWRAP)) == 767 (TS_WRAPPED|TS_AUTOWRAP)) { 768 teken_pos_t tp; 769 770 /* Perform line wrapping. */ 771 772 if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) { --- 28 unchanged lines hidden (view full) --- 801 802 if (t->t_cursor.tp_col >= t->t_winsize.tp_col) { 803 t->t_stateflags |= TS_WRAPPED; 804 t->t_cursor.tp_col = t->t_winsize.tp_col - 1; 805 } else { 806 t->t_stateflags &= ~TS_WRAPPED; 807 } 808 } | 750 if (t->t_cursor.tp_col == t->t_winsize.tp_col - 1 && 751 (t->t_stateflags & (TS_WRAPPED|TS_AUTOWRAP)) == 752 (TS_WRAPPED|TS_AUTOWRAP)) { 753 teken_pos_t tp; 754 755 /* Perform line wrapping. */ 756 757 if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) { --- 28 unchanged lines hidden (view full) --- 786 787 if (t->t_cursor.tp_col >= t->t_winsize.tp_col) { 788 t->t_stateflags |= TS_WRAPPED; 789 t->t_cursor.tp_col = t->t_winsize.tp_col - 1; 790 } else { 791 t->t_stateflags &= ~TS_WRAPPED; 792 } 793 } |
809#endif /* TEKEN_CONS25 */ | 794#else /* !TEKEN_XTERM */ 795 teken_subr_do_putchar(t, &t->t_cursor, c, width); 796 t->t_cursor.tp_col += width; |
810 | 797 |
798 if (t->t_cursor.tp_col >= t->t_winsize.tp_col) { 799 if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) { 800 /* Perform scrolling. */ 801 teken_subr_do_scroll(t, 1); 802 } else { 803 /* No scrolling needed. */ 804 if (t->t_cursor.tp_row < t->t_winsize.tp_row - 1) 805 t->t_cursor.tp_row++; 806 } 807 t->t_cursor.tp_col = 0; 808 } 809#endif /* TEKEN_XTERM */ 810 |
|
811 teken_funcs_cursor(t); 812} 813 814static void 815teken_subr_reset_dec_mode(teken_t *t, unsigned int cmd) 816{ 817 818 switch (cmd) { --- 344 unchanged lines hidden --- | 811 teken_funcs_cursor(t); 812} 813 814static void 815teken_subr_reset_dec_mode(teken_t *t, unsigned int cmd) 816{ 817 818 switch (cmd) { --- 344 unchanged lines hidden --- |