From 0c41364e3d632e0f284a16d4422ff15fdce213a1 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Wed, 20 May 2020 14:24:44 +0200 Subject: [PATCH] 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. --- README.md | 4 ++-- st.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5a636c0..9394a5e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.8.3 (53d521, 2020-05-09) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. +Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.8.3 (aee9f9, 2020-05-09) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/st-flexipatch/blob/master/patches.def.h): ```c @@ -15,7 +15,7 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the ### Changelog: -2020-05-20 - Upgrade to 53d521, 2020-05-09, removed visualbell 1, 2, 3 patches and force redraw after keypress due to incompatibility +2020-05-20 - Upgrade to aee9f9, 2020-05-09, removed visualbell 1, 2, 3 patches and force redraw after keypress due to incompatibility 2020-04-20 - Upgrade to c279f5, 2020-04-19, and added the force redraw on pselect after key is pressed patch and the externalpipein patch diff --git a/st.c b/st.c index 1e9167f..8a2ba1e 100644 --- a/st.c +++ b/st.c @@ -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 {