iDo not mark as invalid UTF8 control codes - st - Simple Terminal Err gopher.r-36.net 70 hgit clone git://r-36.net/st URL:git://r-36.net/st gopher.r-36.net 70 1Log /scm/st/log.gph gopher.r-36.net 70 1Files /scm/st/files.gph gopher.r-36.net 70 1Refs /scm/st/refs.gph gopher.r-36.net 70 1README /scm/st/file/README.gph gopher.r-36.net 70 1LICENSE /scm/st/file/LICENSE.gph gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1commit 7e61f5e4c514a233250442263b62d887c9e5ca9c /scm/st/commit/7e61f5e4c514a233250442263b62d887c9e5ca9c.gph gopher.r-36.net 70 1parent 9984ad4ba730b043d064095dca42b490904e38f3 /scm/st/commit/9984ad4ba730b043d064095dca42b490904e38f3.gph gopher.r-36.net 70 hAuthor: Roberto E. Vargas Caballero URL:mailto:k0ga@shike2.com gopher.r-36.net 70 iDate: Mon, 17 Aug 2015 11:25:38 +0200 Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iDo not mark as invalid UTF8 control codes Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iwcwidth() returns -1 for all the non visible characters, but it doesn't Err gopher.r-36.net 70 inecessarilly mean that they are incorrect. It only means that they are not Err gopher.r-36.net 70 iprintable. Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iDiffstat: Err gopher.r-36.net 70 i M st.c | 4 ++-- Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i1 file changed, 2 insertions(+), 2 deletions(-) Err gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1diff --git a/st.c b/st.c /scm/st/file/st.c.gph gopher.r-36.net 70 i@@ -2895,15 +2895,15 @@ tputc(Rune u) Err gopher.r-36.net 70 i int width, len; Err gopher.r-36.net 70 i Glyph *gp; Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i+ control = ISCONTROL(u); Err gopher.r-36.net 70 i len = utf8encode(u, c); Err gopher.r-36.net 70 i- if ((width = wcwidth(u)) == -1) { Err gopher.r-36.net 70 i+ if (!control && (width = wcwidth(u)) == -1) { Err gopher.r-36.net 70 i memcpy(c, "\357\277\275", 4); /* UTF_INVALID */ Err gopher.r-36.net 70 i width = 1; Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i if (IS_SET(MODE_PRINT)) Err gopher.r-36.net 70 i tprinter(c, len); Err gopher.r-36.net 70 i- control = ISCONTROL(u); Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i /* Err gopher.r-36.net 70 i * STR sequence must be checked before anything else Err gopher.r-36.net 70 .