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:
bakkeby 2020-05-20 14:24:44 +02:00
parent 6bf5eb8a38
commit 0c41364e3d
2 changed files with 3 additions and 3 deletions

2
st.c
View file

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