aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorRoberto E. Vargas Caballero <k0ga@shike2.com>2015-08-17 11:25:38 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2015-08-18 08:31:51 +0200
commit7e61f5e4c514a233250442263b62d887c9e5ca9c (patch)
treed440361a9beb09899b2ecc35558b370efe0e5e86 /st.c
parent9984ad4ba730b043d064095dca42b490904e38f3 (diff)
downloadst-7e61f5e4c514a233250442263b62d887c9e5ca9c.tar.gz
st-7e61f5e4c514a233250442263b62d887c9e5ca9c.zip
Do not mark as invalid UTF8 control codes
wcwidth() returns -1 for all the non visible characters, but it doesn't necessarilly mean that they are incorrect. It only means that they are not printable.
Diffstat (limited to 'st.c')
-rw-r--r--st.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/st.c b/st.c
index 1df4fde..35a840b 100644
--- a/st.c
+++ b/st.c
@@ -2895,15 +2895,15 @@ tputc(Rune u)
2895 int width, len; 2895 int width, len;
2896 Glyph *gp; 2896 Glyph *gp;
2897 2897
2898 control = ISCONTROL(u);
2898 len = utf8encode(u, c); 2899 len = utf8encode(u, c);
2899 if ((width = wcwidth(u)) == -1) { 2900 if (!control && (width = wcwidth(u)) == -1) {
2900 memcpy(c, "\357\277\275", 4); /* UTF_INVALID */ 2901 memcpy(c, "\357\277\275", 4); /* UTF_INVALID */
2901 width = 1; 2902 width = 1;
2902 } 2903 }
2903 2904
2904 if (IS_SET(MODE_PRINT)) 2905 if (IS_SET(MODE_PRINT))
2905 tprinter(c, len); 2906 tprinter(c, len);
2906 control = ISCONTROL(u);
2907 2907
2908 /* 2908 /*
2909 * STR sequence must be checked before anything else 2909 * STR sequence must be checked before anything else