Ignore all control characters not handled

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Mon, 24 Sep 2012 23:03:34 +0200

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(-)
diff --git a/st.c b/st.c
index 009ccb4..e1cb4a8 100644
--- a/st.c
+++ b/st.c
_AT_@ -1642,7 +1642,7 @@ tputtab(bool forward) {
 
 void
 tputc(char *c, int len) {
-	char ascii = *c;
+	uchar ascii = *c;
 
 	if(iofd != -1)
 		write(iofd, c, len);
_AT_@ -1761,8 +1761,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;
_AT_@ -1787,13 +1785,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;
+			}
 		}
 	}
 }
-- 
1.7.10.4
--qMm9M+Fa2AknHoGS
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment; filename="0002-Allow-control-characters-inside-escape-sequences.patch"
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 27 2012 - 07:36:01 CEST