summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-06-01 22:52:07 +0200
committerBoris Faure <billiob@gmail.com>2015-06-02 21:47:06 +0200
commitc86b35309cf2cad82875dfc213ce3a398f8ec92d (patch)
treedd60ab288f5bc5370e35996d40c1dbd31aa1cc87 /src
parent9ecda225b89c3c181a94a60a4a3f1b4288a264ad (diff)
rename a bunch of _termpty_*() to termpty_*()
Diffstat (limited to 'src')
-rw-r--r--src/bin/termpty.c2
-rw-r--r--src/bin/termptyesc.c69
-rw-r--r--src/bin/termptyops.c62
-rw-r--r--src/bin/termptyops.h25
4 files changed, 82 insertions, 76 deletions
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index be6d793..c9b8b7d 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -307,7 +307,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
307 ty->h = h; 307 ty->h = h;
308 ty->backmax = backscroll; 308 ty->backmax = backscroll;
309 309
310 _termpty_reset_state(ty); 310 termpty_reset_state(ty);
311 311
312 ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h); 312 ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h);
313 if (!ty->screen) 313 if (!ty->screen)
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 530a97a..14dbbb7 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -91,7 +91,7 @@ _handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
91 ty->termstate.wrapnext = 0; 91 ty->termstate.wrapnext = 0;
92 if (ty->termstate.crlf) ty->cursor_state.cx = 0; 92 if (ty->termstate.crlf) ty->cursor_state.cx = 0;
93 ty->cursor_state.cy++; 93 ty->cursor_state.cy++;
94 _termpty_text_scroll_test(ty, EINA_TRUE); 94 termpty_text_scroll_test(ty, EINA_TRUE);
95 return; 95 return;
96 case 0x0d: // CR '\r' (carriage ret) 96 case 0x0d: // CR '\r' (carriage ret)
97 DBG("->CR"); 97 DBG("->CR");
@@ -119,7 +119,7 @@ _switch_to_alternative_screen(Termpty *ty, int mode)
119 // clear main buf before we swap it back 119 // clear main buf before we swap it back
120 // into the screen2 save (so save is 120 // into the screen2 save (so save is
121 // clear) 121 // clear)
122 _termpty_clear_all(ty); 122 termpty_clear_all(ty);
123 } 123 }
124 // swap screen content now 124 // swap screen content now
125 if (mode != ty->altbuf) 125 if (mode != ty->altbuf)
@@ -170,8 +170,8 @@ _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b)
170 4 + ty->h * h); 170 4 + ty->h * h);
171 termpty_resize(ty, mode ? 132 : 80, 171 termpty_resize(ty, mode ? 132 : 80,
172 ty->h); 172 ty->h);
173 _termpty_reset_state(ty); 173 termpty_reset_state(ty);
174 _termpty_clear_screen(ty, 174 termpty_clear_screen(ty,
175 TERMPTY_CLR_ALL); 175 TERMPTY_CLR_ALL);
176 } 176 }
177#endif 177#endif
@@ -312,7 +312,7 @@ _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b)
312 break; 312 break;
313 case 1048: 313 case 1048:
314 case 1049: 314 case 1049:
315 _termpty_cursor_copy(ty, mode); 315 termpty_cursor_copy(ty, mode);
316 if (arg == 1049) 316 if (arg == 1049)
317 _switch_to_alternative_screen(ty, mode); 317 _switch_to_alternative_screen(ty, mode);
318 break; 318 break;
@@ -378,14 +378,14 @@ _handle_esc_csi_color_set(Termpty *ty, Eina_Unicode **ptr)
378 { 378 {
379 int arg = _csi_arg_get(&b); 379 int arg = _csi_arg_get(&b);
380 if ((first) && (!b)) 380 if ((first) && (!b))
381 _termpty_reset_att(&(ty->termstate.att)); 381 termpty_reset_att(&(ty->termstate.att));
382 else if (b) 382 else if (b)
383 { 383 {
384 first = 0; 384 first = 0;
385 switch (arg) 385 switch (arg)
386 { 386 {
387 case 0: // reset to normal 387 case 0: // reset to normal
388 _termpty_reset_att(&(ty->termstate.att)); 388 termpty_reset_att(&(ty->termstate.att));
389 break; 389 break;
390 case 1: // bold/bright 390 case 1: // bold/bright
391 ty->termstate.att.bold = 1; 391 ty->termstate.att.bold = 1;
@@ -679,7 +679,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
679 ty->termstate.wrapnext = 0; 679 ty->termstate.wrapnext = 0;
680 ty->termstate.insert = 1; 680 ty->termstate.insert = 1;
681 for (i = 0; i < arg; i++) 681 for (i = 0; i < arg; i++)
682 _termpty_text_append(ty, blank, 1); 682 termpty_text_append(ty, blank, 1);
683 ty->termstate.insert = pi; 683 ty->termstate.insert = pi;
684 ty->cursor_state.cx = cx; 684 ty->cursor_state.cx = cx;
685 } 685 }
@@ -793,19 +793,21 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
793 arg = _csi_arg_get(&b); 793 arg = _csi_arg_get(&b);
794 if (arg < 1) arg = 1; 794 if (arg < 1) arg = 1;
795 DBG("erase %d chars", arg); 795 DBG("erase %d chars", arg);
796 _termpty_clear_line(ty, TERMPTY_CLR_END, arg); 796 termpty_clear_line(ty, TERMPTY_CLR_END, arg);
797 break; 797 break;
798 case 'S': // scroll up N lines 798 case 'S': // scroll up N lines
799 arg = _csi_arg_get(&b); 799 arg = _csi_arg_get(&b);
800 if (arg < 1) arg = 1; 800 if (arg < 1) arg = 1;
801 DBG("scroll up %d lines", arg); 801 DBG("scroll up %d lines", arg);
802 for (i = 0; i < arg; i++) _termpty_text_scroll(ty, EINA_TRUE); 802 for (i = 0; i < arg; i++)
803 termpty_text_scroll(ty, EINA_TRUE);
803 break; 804 break;
804 case 'T': // scroll down N lines 805 case 'T': // scroll down N lines
805 arg = _csi_arg_get(&b); 806 arg = _csi_arg_get(&b);
806 if (arg < 1) arg = 1; 807 if (arg < 1) arg = 1;
807 DBG("scroll down %d lines", arg); 808 DBG("scroll down %d lines", arg);
808 for (i = 0; i < arg; i++) _termpty_text_scroll_rev(ty, EINA_TRUE); 809 for (i = 0; i < arg; i++)
810 termpty_text_scroll_rev(ty, EINA_TRUE);
809 break; 811 break;
810 case 'M': // delete N lines - cy 812 case 'M': // delete N lines - cy
811 case 'L': // insert N lines - cy 813 case 'L': // insert N lines - cy
@@ -830,8 +832,10 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
830 } 832 }
831 for (i = 0; i < arg; i++) 833 for (i = 0; i < arg; i++)
832 { 834 {
833 if (*cc == 'M') _termpty_text_scroll(ty, EINA_TRUE); 835 if (*cc == 'M')
834 else _termpty_text_scroll_rev(ty, EINA_TRUE); 836 termpty_text_scroll(ty, EINA_TRUE);
837 else
838 termpty_text_scroll_rev(ty, EINA_TRUE);
835 } 839 }
836 ty->termstate.scroll_y1 = sy1; 840 ty->termstate.scroll_y1 = sy1;
837 ty->termstate.scroll_y2 = sy2; 841 ty->termstate.scroll_y2 = sy2;
@@ -899,11 +903,12 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
899 if (b) 903 if (b)
900 { 904 {
901 if ((arg >= TERMPTY_CLR_END) && (arg <= TERMPTY_CLR_ALL)) 905 if ((arg >= TERMPTY_CLR_END) && (arg <= TERMPTY_CLR_ALL))
902 _termpty_clear_screen(ty, arg); 906 termpty_clear_screen(ty, arg);
903 else 907 else
904 ERR("invalid clr scr %i", arg); 908 ERR("invalid clr scr %i", arg);
905 } 909 }
906 else _termpty_clear_screen(ty, TERMPTY_CLR_END); 910 else
911 termpty_clear_screen(ty, TERMPTY_CLR_END);
907 break; 912 break;
908 case 'K': // 0K erase to end of line, 1K erase from screen start to cursor, 2K erase all of line 913 case 'K': // 0K erase to end of line, 1K erase from screen start to cursor, 2K erase all of line
909 arg = _csi_arg_get(&b); 914 arg = _csi_arg_get(&b);
@@ -911,11 +916,11 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
911 if (b) 916 if (b)
912 { 917 {
913 if ((arg >= TERMPTY_CLR_END) && (arg <= TERMPTY_CLR_ALL)) 918 if ((arg >= TERMPTY_CLR_END) && (arg <= TERMPTY_CLR_ALL))
914 _termpty_clear_line(ty, arg, ty->w); 919 termpty_clear_line(ty, arg, ty->w);
915 else 920 else
916 ERR("invalid clr lin %i", arg); 921 ERR("invalid clr lin %i", arg);
917 } 922 }
918 else _termpty_clear_line(ty, TERMPTY_CLR_END, ty->w); 923 else termpty_clear_line(ty, TERMPTY_CLR_END, ty->w);
919 break; 924 break;
920 case 'h': 925 case 'h':
921 case 'l': 926 case 'l':
@@ -963,16 +968,16 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
963 } 968 }
964 break; 969 break;
965 case 's': // store cursor pos 970 case 's': // store cursor pos
966 _termpty_cursor_copy(ty, EINA_TRUE); 971 termpty_cursor_copy(ty, EINA_TRUE);
967 break; 972 break;
968 case 'u': // restore cursor pos 973 case 'u': // restore cursor pos
969 _termpty_cursor_copy(ty, EINA_FALSE); 974 termpty_cursor_copy(ty, EINA_FALSE);
970 break; 975 break;
971 case 'p': // define key assignments based on keycode 976 case 'p': // define key assignments based on keycode
972 if (b && *b == '!') 977 if (b && *b == '!')
973 { 978 {
974 DBG("soft reset (DECSTR)"); 979 DBG("soft reset (DECSTR)");
975 _termpty_reset_state(ty); 980 termpty_reset_state(ty);
976 } 981 }
977 else 982 else
978 { 983 {
@@ -1564,26 +1569,26 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
1564 case 'M': // move to prev line 1569 case 'M': // move to prev line
1565 ty->termstate.wrapnext = 0; 1570 ty->termstate.wrapnext = 0;
1566 ty->cursor_state.cy--; 1571 ty->cursor_state.cy--;
1567 _termpty_text_scroll_rev_test(ty, EINA_TRUE); 1572 termpty_text_scroll_rev_test(ty, EINA_TRUE);
1568 return 1; 1573 return 1;
1569 case 'D': // move to next line 1574 case 'D': // move to next line
1570 ty->termstate.wrapnext = 0; 1575 ty->termstate.wrapnext = 0;
1571 ty->cursor_state.cy++; 1576 ty->cursor_state.cy++;
1572 _termpty_text_scroll_test(ty, EINA_FALSE); 1577 termpty_text_scroll_test(ty, EINA_FALSE);
1573 return 1; 1578 return 1;
1574 case 'E': // add \n\r 1579 case 'E': // add \n\r
1575 ty->termstate.wrapnext = 0; 1580 ty->termstate.wrapnext = 0;
1576 ty->cursor_state.cx = 0; 1581 ty->cursor_state.cx = 0;
1577 ty->cursor_state.cy++; 1582 ty->cursor_state.cy++;
1578 _termpty_text_scroll_test(ty, EINA_FALSE); 1583 termpty_text_scroll_test(ty, EINA_FALSE);
1579 return 1; 1584 return 1;
1580 case 'Z': // same a 'ESC [ Pn c' 1585 case 'Z': // same a 'ESC [ Pn c'
1581 _term_txt_write(ty, "\033[?1;2C"); 1586 _term_txt_write(ty, "\033[?1;2C");
1582 return 1; 1587 return 1;
1583 case 'c': // reset terminal to initial state 1588 case 'c': // reset terminal to initial state
1584 DBG("reset to init mode and clear"); 1589 DBG("reset to init mode and clear");
1585 _termpty_reset_state(ty); 1590 termpty_reset_state(ty);
1586 _termpty_clear_screen(ty, TERMPTY_CLR_ALL); 1591 termpty_clear_screen(ty, TERMPTY_CLR_ALL);
1587 if (ty->cb.cancel_sel.func) 1592 if (ty->cb.cancel_sel.func)
1588 ty->cb.cancel_sel.func(ty->cb.cancel_sel.data); 1593 ty->cb.cancel_sel.func(ty->cb.cancel_sel.data);
1589 return 1; 1594 return 1;
@@ -1621,8 +1626,8 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
1621 Termcell *cells; 1626 Termcell *cells;
1622 1627
1623 DBG("reset to init mode and clear then fill with E"); 1628 DBG("reset to init mode and clear then fill with E");
1624 _termpty_reset_state(ty); 1629 termpty_reset_state(ty);
1625 _termpty_clear_screen(ty, TERMPTY_CLR_ALL); 1630 termpty_clear_screen(ty, TERMPTY_CLR_ALL);
1626 if (ty->cb.cancel_sel.func) 1631 if (ty->cb.cancel_sel.func)
1627 ty->cb.cancel_sel.func(ty->cb.cancel_sel.data); 1632 ty->cb.cancel_sel.func(ty->cb.cancel_sel.data);
1628 cells = ty->screen; 1633 cells = ty->screen;
@@ -1640,10 +1645,10 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
1640 if (len < 2) return 0; 1645 if (len < 2) return 0;
1641 return 2; 1646 return 2;
1642 case '7': // save cursor pos 1647 case '7': // save cursor pos
1643 _termpty_cursor_copy(ty, EINA_TRUE); 1648 termpty_cursor_copy(ty, EINA_TRUE);
1644 return 1; 1649 return 1;
1645 case '8': // restore cursor pos 1650 case '8': // restore cursor pos
1646 _termpty_cursor_copy(ty, EINA_FALSE); 1651 termpty_cursor_copy(ty, EINA_FALSE);
1647 return 1; 1652 return 1;
1648 case 'H': // set tab at current column 1653 case 'H': // set tab at current column
1649 DBG("Character Tabulation Set (HTS)"); 1654 DBG("Character Tabulation Set (HTS)");
@@ -1808,7 +1813,7 @@ termpty_handle_seq(Termpty *ty, Eina_Unicode *c, Eina_Unicode *ce)
1808 ex->y++; 1813 ex->y++;
1809 } 1814 }
1810 ex->left--; 1815 ex->left--;
1811 _termpty_text_append(ty, &cp, 1); 1816 termpty_text_append(ty, &cp, 1);
1812 if (ex->left <= 0) 1817 if (ex->left <= 0)
1813 { 1818 {
1814 ty->block.expecting = 1819 ty->block.expecting =
@@ -1821,7 +1826,7 @@ termpty_handle_seq(Termpty *ty, Eina_Unicode *c, Eina_Unicode *ce)
1821 return 1; 1826 return 1;
1822 } 1827 }
1823 } 1828 }
1824 _termpty_text_append(ty, c, 1); 1829 termpty_text_append(ty, c, 1);
1825 return 1; 1830 return 1;
1826 } 1831 }
1827 else 1832 else
@@ -1837,7 +1842,7 @@ termpty_handle_seq(Termpty *ty, Eina_Unicode *c, Eina_Unicode *ce)
1837 len++; 1842 len++;
1838 } 1843 }
1839 DBG("]"); 1844 DBG("]");
1840 _termpty_text_append(ty, c, len); 1845 termpty_text_append(ty, c, len);
1841 ty->termstate.had_cr = 0; 1846 ty->termstate.had_cr = 0;
1842 return len; 1847 return len;
1843} 1848}
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index d1641f1..e9d93f8 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -20,14 +20,14 @@
20#define INF(...) EINA_LOG_DOM_INFO(_termpty_log_dom, __VA_ARGS__) 20#define INF(...) EINA_LOG_DOM_INFO(_termpty_log_dom, __VA_ARGS__)
21#define DBG(...) EINA_LOG_DOM_DBG(_termpty_log_dom, __VA_ARGS__) 21#define DBG(...) EINA_LOG_DOM_DBG(_termpty_log_dom, __VA_ARGS__)
22 22
23static void 23void
24_text_clear(Termpty *ty, Termcell *cells, int count, int val, Eina_Bool inherit_att) 24termpty_cells_clear(Termpty *ty, Termcell *cells, int count)
25{ 25{
26 Termcell src; 26 Termcell src;
27 27
28 memset(&src, 0, sizeof(src)); 28 memset(&src, 0, sizeof(src));
29 src.codepoint = val; 29 src.codepoint = 0;
30 if (inherit_att) src.att = ty->termstate.att; 30 src.att = ty->termstate.att;
31 termpty_cell_fill(ty, &src, cells, count); 31 termpty_cell_fill(ty, &src, cells, count);
32} 32}
33 33
@@ -60,7 +60,7 @@ termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max)
60} 60}
61 61
62void 62void
63_termpty_text_scroll(Termpty *ty, Eina_Bool clear) 63termpty_text_scroll(Termpty *ty, Eina_Bool clear)
64{ 64{
65 Termcell *cells = NULL, *cells2; 65 Termcell *cells = NULL, *cells2;
66 int y, start_y = 0, end_y = ty->h - 1; 66 int y, start_y = 0, end_y = ty->h - 1;
@@ -82,7 +82,7 @@ _termpty_text_scroll(Termpty *ty, Eina_Bool clear)
82 // screen is a circular buffer now 82 // screen is a circular buffer now
83 cells = &(ty->screen[ty->circular_offset * ty->w]); 83 cells = &(ty->screen[ty->circular_offset * ty->w]);
84 if (clear) 84 if (clear)
85 _text_clear(ty, cells, ty->w, 0, EINA_TRUE); 85 termpty_cells_clear(ty, cells, ty->w);
86 86
87 ty->circular_offset++; 87 ty->circular_offset++;
88 if (ty->circular_offset >= ty->h) 88 if (ty->circular_offset >= ty->h)
@@ -98,12 +98,12 @@ _termpty_text_scroll(Termpty *ty, Eina_Bool clear)
98 termpty_cell_copy(ty, cells, cells2, ty->w); 98 termpty_cell_copy(ty, cells, cells2, ty->w);
99 } 99 }
100 if (clear) 100 if (clear)
101 _text_clear(ty, cells, ty->w, 0, EINA_TRUE); 101 termpty_cells_clear(ty, cells, ty->w);
102 } 102 }
103} 103}
104 104
105void 105void
106_termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear) 106termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
107{ 107{
108 Termcell *cells, *cells2 = NULL; 108 Termcell *cells, *cells2 = NULL;
109 int y, start_y = 0, end_y = ty->h - 1; 109 int y, start_y = 0, end_y = ty->h - 1;
@@ -125,7 +125,7 @@ _termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
125 125
126 cells = &(ty->screen[ty->circular_offset * ty->w]); 126 cells = &(ty->screen[ty->circular_offset * ty->w]);
127 if (clear) 127 if (clear)
128 _text_clear(ty, cells, ty->w, 0, EINA_TRUE); 128 termpty_cells_clear(ty, cells, ty->w);
129 } 129 }
130 else 130 else
131 { 131 {
@@ -137,38 +137,38 @@ _termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
137 termpty_cell_copy(ty, cells, cells2, ty->w); 137 termpty_cell_copy(ty, cells, cells2, ty->w);
138 } 138 }
139 if (clear) 139 if (clear)
140 _text_clear(ty, cells, ty->w, 0, EINA_TRUE); 140 termpty_cells_clear(ty, cells, ty->w);
141 } 141 }
142} 142}
143 143
144void 144void
145_termpty_text_scroll_test(Termpty *ty, Eina_Bool clear) 145termpty_text_scroll_test(Termpty *ty, Eina_Bool clear)
146{ 146{
147 int e = ty->h; 147 int e = ty->h;
148 148
149 if (ty->termstate.scroll_y2 != 0) e = ty->termstate.scroll_y2; 149 if (ty->termstate.scroll_y2 != 0) e = ty->termstate.scroll_y2;
150 if (ty->cursor_state.cy >= e) 150 if (ty->cursor_state.cy >= e)
151 { 151 {
152 _termpty_text_scroll(ty, clear); 152 termpty_text_scroll(ty, clear);
153 ty->cursor_state.cy = e - 1; 153 ty->cursor_state.cy = e - 1;
154 } 154 }
155} 155}
156 156
157void 157void
158_termpty_text_scroll_rev_test(Termpty *ty, Eina_Bool clear) 158termpty_text_scroll_rev_test(Termpty *ty, Eina_Bool clear)
159{ 159{
160 int b = 0; 160 int b = 0;
161 161
162 if (ty->termstate.scroll_y1 != 0) b = ty->termstate.scroll_y1; 162 if (ty->termstate.scroll_y1 != 0) b = ty->termstate.scroll_y1;
163 if (ty->cursor_state.cy < b) 163 if (ty->cursor_state.cy < b)
164 { 164 {
165 _termpty_text_scroll_rev(ty, clear); 165 termpty_text_scroll_rev(ty, clear);
166 ty->cursor_state.cy = b; 166 ty->cursor_state.cy = b;
167 } 167 }
168} 168}
169 169
170void 170void
171_termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len) 171termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
172{ 172{
173 Termcell *cells; 173 Termcell *cells;
174 int i, j; 174 int i, j;
@@ -186,7 +186,7 @@ _termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
186 ty->termstate.wrapnext = 0; 186 ty->termstate.wrapnext = 0;
187 ty->cursor_state.cx = 0; 187 ty->cursor_state.cx = 0;
188 ty->cursor_state.cy++; 188 ty->cursor_state.cy++;
189 _termpty_text_scroll_test(ty, EINA_TRUE); 189 termpty_text_scroll_test(ty, EINA_TRUE);
190 cells = &(TERMPTY_SCREEN(ty, 0, ty->cursor_state.cy)); 190 cells = &(TERMPTY_SCREEN(ty, 0, ty->cursor_state.cy));
191 } 191 }
192 if (ty->termstate.insert) 192 if (ty->termstate.insert)
@@ -242,7 +242,7 @@ _termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
242} 242}
243 243
244void 244void
245_termpty_clear_line(Termpty *ty, Termpty_Clear mode, int limit) 245termpty_clear_line(Termpty *ty, Termpty_Clear mode, int limit)
246{ 246{
247 Termcell *cells; 247 Termcell *cells;
248 int n = 0; 248 int n = 0;
@@ -266,18 +266,18 @@ _termpty_clear_line(Termpty *ty, Termpty_Clear mode, int limit)
266 cells = &(TERMPTY_SCREEN(ty, x, y)); 266 cells = &(TERMPTY_SCREEN(ty, x, y));
267 if (n > limit) n = limit; 267 if (n > limit) n = limit;
268 termio_content_change(ty->obj, x, y, n); 268 termio_content_change(ty->obj, x, y, n);
269 _text_clear(ty, cells, n, 0, EINA_TRUE); 269 termpty_cells_clear(ty, cells, n);
270} 270}
271 271
272void 272void
273_termpty_clear_screen(Termpty *ty, Termpty_Clear mode) 273termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
274{ 274{
275 Termcell *cells; 275 Termcell *cells;
276 276
277 switch (mode) 277 switch (mode)
278 { 278 {
279 case TERMPTY_CLR_END: 279 case TERMPTY_CLR_END:
280 _termpty_clear_line(ty, mode, ty->w); 280 termpty_clear_line(ty, mode, ty->w);
281 if (ty->cursor_state.cy < (ty->h - 1)) 281 if (ty->cursor_state.cy < (ty->h - 1))
282 { 282 {
283 int l = ty->h - (ty->cursor_state.cy + 1); 283 int l = ty->h - (ty->cursor_state.cy + 1);
@@ -287,7 +287,7 @@ _termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
287 while (l) 287 while (l)
288 { 288 {
289 cells = &(TERMPTY_SCREEN(ty, 0, (ty->cursor_state.cy + l))); 289 cells = &(TERMPTY_SCREEN(ty, 0, (ty->cursor_state.cy + l)));
290 _text_clear(ty, cells, ty->w, 0, EINA_TRUE); 290 termpty_cells_clear(ty, cells, ty->w);
291 l--; 291 l--;
292 } 292 }
293 } 293 }
@@ -304,22 +304,22 @@ _termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
304 304
305 if (y < ty->h) 305 if (y < ty->h)
306 { 306 {
307 _text_clear(ty, cells, ty->w * ty->cursor_state.cy, 0, EINA_TRUE); 307 termpty_cells_clear(ty, cells, ty->w * ty->cursor_state.cy);
308 } 308 }
309 else 309 else
310 { 310 {
311 int yt = y % ty->w; 311 int yt = y % ty->w;
312 int yb = ty->h - ty->circular_offset; 312 int yb = ty->h - ty->circular_offset;
313 313
314 _text_clear(ty, cells, ty->w * yb, 0, EINA_TRUE); 314 termpty_cells_clear(ty, cells, ty->w * yb);
315 _text_clear(ty, ty->screen, ty->w * yt, 0, EINA_TRUE); 315 termpty_cells_clear(ty, ty->screen, ty->w * yt);
316 } 316 }
317 } 317 }
318 _termpty_clear_line(ty, mode, ty->w); 318 termpty_clear_line(ty, mode, ty->w);
319 break; 319 break;
320 case TERMPTY_CLR_ALL: 320 case TERMPTY_CLR_ALL:
321 ty->circular_offset = 0; 321 ty->circular_offset = 0;
322 _text_clear(ty, ty->screen, ty->w * ty->h, 0, EINA_TRUE); 322 termpty_cells_clear(ty, ty->screen, ty->w * ty->h);
323 ty->termstate.scroll_y2 = 0; 323 ty->termstate.scroll_y2 = 0;
324 if (ty->cb.cancel_sel.func) 324 if (ty->cb.cancel_sel.func)
325 ty->cb.cancel_sel.func(ty->cb.cancel_sel.data); 325 ty->cb.cancel_sel.func(ty->cb.cancel_sel.data);
@@ -330,14 +330,14 @@ _termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
330} 330}
331 331
332void 332void
333_termpty_clear_all(Termpty *ty) 333termpty_clear_all(Termpty *ty)
334{ 334{
335 if (!ty->screen) return; 335 if (!ty->screen) return;
336 termpty_cell_fill(ty, NULL, ty->screen, ty->w * ty->h); 336 termpty_cell_fill(ty, NULL, ty->screen, ty->w * ty->h);
337} 337}
338 338
339void 339void
340_termpty_reset_att(Termatt *att) 340termpty_reset_att(Termatt *att)
341{ 341{
342 att->fg = COL_DEF; 342 att->fg = COL_DEF;
343 att->bg = COL_DEF; 343 att->bg = COL_DEF;
@@ -365,7 +365,7 @@ _termpty_reset_att(Termatt *att)
365} 365}
366 366
367void 367void
368_termpty_reset_state(Termpty *ty) 368termpty_reset_state(Termpty *ty)
369{ 369{
370 ty->cursor_state.cx = 0; 370 ty->cursor_state.cx = 0;
371 ty->cursor_state.cy = 0; 371 ty->cursor_state.cy = 0;
@@ -373,7 +373,7 @@ _termpty_reset_state(Termpty *ty)
373 ty->termstate.scroll_y2 = 0; 373 ty->termstate.scroll_y2 = 0;
374 ty->termstate.had_cr_x = 0; 374 ty->termstate.had_cr_x = 0;
375 ty->termstate.had_cr_y = 0; 375 ty->termstate.had_cr_y = 0;
376 _termpty_reset_att(&(ty->termstate.att)); 376 termpty_reset_att(&(ty->termstate.att));
377 ty->termstate.charset = 0; 377 ty->termstate.charset = 0;
378 ty->termstate.charsetch = 'B'; 378 ty->termstate.charsetch = 'B';
379 ty->termstate.chset[0] = 'B'; 379 ty->termstate.chset[0] = 'B';
@@ -416,7 +416,7 @@ _termpty_reset_state(Termpty *ty)
416} 416}
417 417
418void 418void
419_termpty_cursor_copy(Termpty *ty, Eina_Bool save) 419termpty_cursor_copy(Termpty *ty, Eina_Bool save)
420{ 420{
421 if (save) 421 if (save)
422 { 422 {
diff --git a/src/bin/termptyops.h b/src/bin/termptyops.h
index 890c61d..08de5ab 100644
--- a/src/bin/termptyops.h
+++ b/src/bin/termptyops.h
@@ -9,18 +9,19 @@ typedef enum _Termpty_Clear
9} Termpty_Clear; 9} Termpty_Clear;
10 10
11void termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max); 11void termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max);
12void _termpty_text_copy(Termpty *ty, Termcell *cells, Termcell *dest, int count); 12void termpty_cells_copy(Termpty *ty, Termcell *cells, Termcell *dest, int count);
13void _termpty_text_scroll(Termpty *ty, Eina_Bool clear); 13void termpty_cells_clear(Termpty *ty, Termcell *cells, int count);
14void _termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear); 14void termpty_text_scroll(Termpty *ty, Eina_Bool clear);
15void _termpty_text_scroll_test(Termpty *ty, Eina_Bool clear); 15void termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear);
16void _termpty_text_scroll_rev_test(Termpty *ty, Eina_Bool clear); 16void termpty_text_scroll_test(Termpty *ty, Eina_Bool clear);
17void _termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len); 17void termpty_text_scroll_rev_test(Termpty *ty, Eina_Bool clear);
18void _termpty_clear_line(Termpty *ty, Termpty_Clear mode, int limit); 18void termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len);
19void _termpty_clear_screen(Termpty *ty, Termpty_Clear mode); 19void termpty_clear_line(Termpty *ty, Termpty_Clear mode, int limit);
20void _termpty_clear_all(Termpty *ty); 20void termpty_clear_screen(Termpty *ty, Termpty_Clear mode);
21void _termpty_reset_att(Termatt *att); 21void termpty_clear_all(Termpty *ty);
22void _termpty_reset_state(Termpty *ty); 22void termpty_reset_att(Termatt *att);
23void _termpty_cursor_copy(Termpty *ty, Eina_Bool save); 23void termpty_reset_state(Termpty *ty);
24void termpty_cursor_copy(Termpty *ty, Eina_Bool save);
24 25
25#define _term_txt_write(ty, txt) termpty_write(ty, txt, sizeof(txt) - 1) 26#define _term_txt_write(ty, txt) termpty_write(ty, txt, sizeof(txt) - 1)
26 27