diff options
| author | czarkoff@gmail.com <czarkoff@gmail.com> | 2014-10-28 12:55:28 +0100 | 
|---|---|---|
| committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-11-03 22:52:58 +0100 | 
| commit | 11625c7166b7e4dad414606227acec2de1c36464 (patch) | |
| tree | 7322869b5d1e0b33a480ce2e34973198b05ccc70 | |
| parent | 008aae541b5cb1e67a025048adef9a06eaa11c2e (diff) | |
| download | st-transparency-11625c7166b7e4dad414606227acec2de1c36464.tar.gz st-transparency-11625c7166b7e4dad414606227acec2de1c36464.tar.xz st-transparency-11625c7166b7e4dad414606227acec2de1c36464.zip  | |
Replace character with U+FFFD if wcwidth() is -1
Helpful when new Unicode codepoints are not recognized by libc.
| -rw-r--r-- | st.c | 5 | 
1 files changed, 4 insertions, 1 deletions
@@ -2576,7 +2576,10 @@ tputc(char *c, int len) {  		unicodep = ascii = *c;  	} else {  		utf8decode(c, &unicodep, UTF_SIZ); -		width = wcwidth(unicodep); +		if ((width = wcwidth(unicodep)) == -1) { +			c = "\357\277\275";	/* UTF_INVALID */ +			width = 1; +		}  		control = ISCONTROLC1(unicodep);  		ascii = unicodep;  	}  | 
