aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto E. Vargas Caballero <k0ga@shike2.com>2012-09-26 20:55:18 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2012-09-26 20:55:18 +0200
commitbcbf5156bee158d3737170a9feda860852149881 (patch)
tree33266c16701061f439d0c9a2b10ddb2b9dc59053
parent18e2def3427e2f4dc2db64f34ed1dd92183fd268 (diff)
downloadst-patched-bcbf5156bee158d3737170a9feda860852149881.tar.bz2
st-patched-bcbf5156bee158d3737170a9feda860852149881.tar.xz
st-patched-bcbf5156bee158d3737170a9feda860852149881.zip
Allow control characters inside escape sequences
Taken from vt100 manual programmer: Control characters (codes \0 to \37 inclusive) are specifically excluded from the control sequence syntax, but may be embedded within a control sequence. Embedded control characters are executed as soon as they are encountered by the VT100. The processing of the control sequence then continues with the next character received. --- st.c | 68 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 34 insertions(+), 34 deletions(-)
-rw-r--r--st.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/st.c b/st.c
index 515dfb1..2767d54 100644
--- a/st.c
+++ b/st.c
@@ -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}