[hackers] [st] Do not mark as invalid UTF8 control codes || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 18 Aug 2015 08:35:13 +0200 (CEST)

commit 7e61f5e4c514a233250442263b62d887c9e5ca9c
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Aug 17 11:25:38 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Aug 18 08:31:51 2015 +0200

    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.

diff --git a/st.c b/st.c
index 1df4fde..35a840b 100644
--- a/st.c
+++ b/st.c
_AT_@ -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
Received on Tue Aug 18 2015 - 08:35:13 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 18 2015 - 08:36:13 CEST