optimize column width calculation and utf-8 encode for ASCII

In particular on OpenBSD and on glibc wcwidth() is quite expensive.
On musl there is little difference.
This commit is contained in:
Hiltjo Posthuma 2020-05-09 14:03:14 +02:00
parent 8211e36d28
commit cde480c693

2
st.c
View file

@ -2307,7 +2307,7 @@ tputc(Rune u)
Glyph *gp; Glyph *gp;
control = ISCONTROL(u); control = ISCONTROL(u);
if (!IS_SET(MODE_UTF8 | MODE_SIXEL)) { if (u < 127 || !IS_SET(MODE_UTF8 | MODE_SIXEL)) {
c[0] = u; c[0] = u;
width = len = 1; width = len = 1;
} else { } else {