diff options
| -rw-r--r-- | st.c | 68 |
1 files changed, 34 insertions, 34 deletions
| @@ -1668,6 +1668,32 @@ tputc(char *c, int len) { | |||
| 1668 | if(iofd != -1) | 1668 | if(iofd != -1) |
| 1669 | write(iofd, c, len); | 1669 | write(iofd, c, len); |
| 1670 | 1670 | ||
| 1671 | switch(ascii) { | ||
| 1672 | case '\t': | ||
| 1673 | tputtab(1); | ||
| 1674 | return; | ||
| 1675 | case '\b': | ||
| 1676 | tmoveto(term.c.x-1, term.c.y); | ||
| 1677 | return; | ||
| 1678 | case '\r': | ||
| 1679 | tmoveto(0, term.c.y); | ||
| 1680 | return; | ||
| 1681 | case '\f': | ||
| 1682 | case '\v': | ||
| 1683 | case '\n': | ||
| 1684 | /* go to first col if the mode is set */ | ||
| 1685 | tnewline(IS_SET(MODE_CRLF)); | ||
| 1686 | return; | ||
| 1687 | case '\a': | ||
| 1688 | if(!(xw.state & WIN_FOCUSED)) | ||
| 1689 | xseturgency(1); | ||
| 1690 | return; | ||
| 1691 | case '\033': | ||
| 1692 | csireset(); | ||
| 1693 | term.esc = ESC_START; | ||
| 1694 | return; | ||
| 1695 | } | ||
| 1696 | |||
| 1671 | if(term.esc & ESC_START) { | 1697 | if(term.esc & ESC_START) { |
| 1672 | if(term.esc & ESC_CSI) { | 1698 | if(term.esc & ESC_CSI) { |
| 1673 | csiescseq.buf[csiescseq.len++] = ascii; | 1699 | csiescseq.buf[csiescseq.len++] = ascii; |
| @@ -1791,40 +1817,14 @@ tputc(char *c, int len) { | |||
| 1791 | } else { | 1817 | } else { |
| 1792 | if(sel.bx != -1 && BETWEEN(term.c.y, sel.by, sel.ey)) | 1818 | if(sel.bx != -1 && BETWEEN(term.c.y, sel.by, sel.ey)) |
| 1793 | sel.bx = -1; | 1819 | sel.bx = -1; |
| 1794 | switch(ascii) { | 1820 | if(ascii >= '\020' || term.c.attr.mode & ATTR_GFX) { |
| 1795 | case '\t': | 1821 | if(IS_SET(MODE_WRAP) && term.c.state & CURSOR_WRAPNEXT) |
| 1796 | tputtab(1); | 1822 | tnewline(1); /* always go to first col */ |
| 1797 | break; | 1823 | tsetchar(c); |
| 1798 | case '\b': | 1824 | if(term.c.x+1 < term.col) |
| 1799 | tmoveto(term.c.x-1, term.c.y); | 1825 | tmoveto(term.c.x+1, term.c.y); |
| 1800 | break; | 1826 | else |
| 1801 | case '\r': | 1827 | term.c.state |= CURSOR_WRAPNEXT; |
| 1802 | tmoveto(0, term.c.y); | ||
| 1803 | break; | ||
| 1804 | case '\f': | ||
| 1805 | case '\v': | ||
| 1806 | case '\n': | ||
| 1807 | /* go to first col if the mode is set */ | ||
| 1808 | tnewline(IS_SET(MODE_CRLF)); | ||
| 1809 | break; | ||
| 1810 | case '\a': | ||
| 1811 | if(!(xw.state & WIN_FOCUSED)) | ||
| 1812 | xseturgency(1); | ||
| 1813 | break; | ||
| 1814 | case '\033': | ||
| 1815 | csireset(); | ||
| 1816 | term.esc = ESC_START; | ||
| 1817 | break; | ||
| 1818 | default: | ||
| 1819 | if(ascii >= '\020' || term.c.attr.mode & ATTR_GFX) { | ||
| 1820 | if(IS_SET(MODE_WRAP) && term.c.state & CURSOR_WRAPNEXT) | ||
| 1821 | tnewline(1); /* always go to first col */ | ||
| 1822 | tsetchar(c); | ||
| 1823 | if(term.c.x+1 < term.col) | ||
| 1824 | tmoveto(term.c.x+1, term.c.y); | ||
| 1825 | else | ||
| 1826 | term.c.state |= CURSOR_WRAPNEXT; | ||
| 1827 | } | ||
| 1828 | } | 1828 | } |
| 1829 | } | 1829 | } |
| 1830 | } | 1830 | } |
