aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto E. Vargas Caballero <k0ga@shike2.com>2012-09-26 20:53:46 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2012-09-26 20:53:46 +0200
commit18e2def3427e2f4dc2db64f34ed1dd92183fd268 (patch)
treec56b0e83628bd0d98eab9c7dfc3d998cb7e095f3
parent1ad0b11415d51a86bacacddd91132b369efaf536 (diff)
downloadst-18e2def3427e2f4dc2db64f34ed1dd92183fd268.tar.gz
st-18e2def3427e2f4dc2db64f34ed1dd92183fd268.tar.bz2
Ignore all control characters not handled
Taken from vt100 programmer manual: Control characters have values of \000 - \037, and \177. The control characters recognized by the VT100 are shown in Table 3-10. All other control codes cause no action to be taken. We have to take attention when we are using alternate charset, because in this cases they are not used as control characters. --- st.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
-rw-r--r--st.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/st.c b/st.c
index a64b84d..515dfb1 100644
--- a/st.c
+++ b/st.c
@@ -1663,7 +1663,7 @@ tputtab(bool forward) {
void
tputc(char *c, int len) {
- char ascii = *c;
+ uchar ascii = *c;
if(iofd != -1)
write(iofd, c, len);
@@ -1792,8 +1792,6 @@ tputc(char *c, int len) {
if(sel.bx != -1 && BETWEEN(term.c.y, sel.by, sel.ey))
sel.bx = -1;
switch(ascii) {
- case '\0': /* padding character, do nothing */
- break;
case '\t':
tputtab(1);
break;
@@ -1818,13 +1816,15 @@ tputc(char *c, int len) {
term.esc = ESC_START;
break;
default:
- 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;
+ }
}
}
}