diff options
author | Thomas Voss <mail@thomasvoss.com> | 2022-10-15 14:07:17 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2022-10-15 14:07:17 +0200 |
commit | 0a25a86c098a2a06d8f6948bdb074e2bc0dcaf4e (patch) | |
tree | f6a17c0ce62ff696d5a46d4b7e733a4a50fb3586 | |
parent | e918d8b8a6ba41a84b7b74a7fb8da39adb773c2e (diff) |
Properly handle backspace charactersv1.1.0
-rw-r--r-- | center.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -230,8 +230,8 @@ utf8len(const char *s) { int l = 0; - while (*s) - l += (*s++ & 0xC0) != 0x80; + for (; *s; s++) + l += *s == '\b' ? -1 : (*s & 0xC0) != 0x80; if (l > 0 && s[-1] == '\n') l--; |