[hackers] [st][PATCH] Do not mark as invalid UTF8 control codes

2015-08-17 Thread Roberto E. Vargas Caballero
wcwidth() returns -1 in all the non visible characters, but it doesn't
mind that they are incorrect. It only means that they are not printable.
---
 st.c | 4 ++--
 1 file 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)
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
-- 
2.1.4




Re: [hackers] [st][PATCH] Do not mark as invalid UTF8 control codes

2015-08-17 Thread Daniel Martí
On Mon, Aug 17, 2015 at 11:29:34 +0200, Roberto E. Vargas Caballero wrote:
 wcwidth() returns -1 in all the non visible characters, but it doesn't
 mind that they are incorrect. It only means that they are not printable.

nits:
s/in all the/for all the/
s/doesn't mind that/doesn't necessarily mean that/

Thanks for your work!

-- 
Daniel Martí - mv...@mvdan.cc - http://mvdan.cc/
PGP: A9DA 13CD F7A1 4ACD D3DE  E530 F4CA FFDB 4348 041C