diff options
author | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2015-08-17 11:25:38 +0200 |
---|---|---|
committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2015-08-18 08:31:51 +0200 |
commit | 7e61f5e4c514a233250442263b62d887c9e5ca9c (patch) | |
tree | d440361a9beb09899b2ecc35558b370efe0e5e86 | |
parent | 9984ad4ba730b043d064095dca42b490904e38f3 (diff) |
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.
-rw-r--r-- | st.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2895,15 +2895,15 @@ tputc(Rune u) int width, len; Glyph *gp; + control = ISCONTROL(u); len = utf8encode(u, c); - if ((width = wcwidth(u)) == -1) { + if (!control && (width = wcwidth(u)) == -1) { memcpy(c, "\357\277\275", 4); /* UTF_INVALID */ width = 1; } if (IS_SET(MODE_PRINT)) tprinter(c, len); - control = ISCONTROL(u); /* * STR sequence must be checked before anything else |