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
commit3af49e34f666554fcd52a52a7ca15f3e7eafa197 (patch)
tree33266c16701061f439d0c9a2b10ddb2b9dc59053
parenta7d7e29300acade90f2025f0b85fa5eae06edb24 (diff)
downloadst-3af49e34f666554fcd52a52a7ca15f3e7eafa197.tar.gz
st-3af49e34f666554fcd52a52a7ca15f3e7eafa197.tar.bz2
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) {
if(iofd != -1)
write(iofd, c, len);
+ switch(ascii) {
+ case '\t':
+ tputtab(1);
+ return;
+ case '\b':
+ tmoveto(term.c.x-1, term.c.y);
+ return;
+ case '\r':
+ tmoveto(0, term.c.y);
+ return;
+ case '\f':
+ case '\v':
+ case '\n':
+ /* go to first col if the mode is set */
+ tnewline(IS_SET(MODE_CRLF));
+ return;
+ case '\a':
+ if(!(xw.state & WIN_FOCUSED))
+ xseturgency(1);
+ return;
+ case '\033':
+ csireset();
+ term.esc = ESC_START;
+ return;
+ }
+
if(term.esc & ESC_START) {
if(term.esc & ESC_CSI) {
csiescseq.buf[csiescseq.len++] = ascii;
@@ -1791,40 +1817,14 @@ tputc(char *c, int len) {
} else {
if(sel.bx != -1 && BETWEEN(term.c.y, sel.by, sel.ey))
sel.bx = -1;
- switch(ascii) {
- case '\t':
- tputtab(1);
- break;
- case '\b':
- tmoveto(term.c.x-1, term.c.y);
- break;
- case '\r':
- tmoveto(0, term.c.y);
- break;
- case '\f':
- case '\v':
- case '\n':
- /* go to first col if the mode is set */
- tnewline(IS_SET(MODE_CRLF));
- break;
- case '\a':
- if(!(xw.state & WIN_FOCUSED))
- xseturgency(1);
- break;
- case '\033':
- csireset();
- term.esc = ESC_START;
- break;
- default:
- if(ascii >= '\020' || term.c.attr.mode & ATTR_GFX) {
- if(IS_SET(MODE_WRAP) && term.c.state & CURSOR_WRAPNEXT)
- tnewline(1); /* always go to first col */
- tsetchar(c);
- if(term.c.x+1 < term.col)
- tmoveto(term.c.x+1, term.c.y);
- else
- term.c.state |= CURSOR_WRAPNEXT;
- }
+ if(ascii >= '\020' || term.c.attr.mode & ATTR_GFX) {
+ if(IS_SET(MODE_WRAP) && term.c.state & CURSOR_WRAPNEXT)
+ tnewline(1); /* always go to first col */
+ tsetchar(c);
+ if(term.c.x+1 < term.col)
+ tmoveto(term.c.x+1, term.c.y);
+ else
+ term.c.state |= CURSOR_WRAPNEXT;
}
}
}