From c2139e2e03cbcee9a1ae03956b1f06d3a9c269b0 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 26 Mar 2022 19:42:13 -0400 Subject: util: New xstrwidth() function --- util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index b780624..b5c7d80 100644 --- a/util.h +++ b/util.h @@ -207,6 +207,16 @@ int xfaccessat(int fd, const char *path, int amode); */ int xstrtofflags(const char **str, unsigned long long *set, unsigned long long *clear); +/** + * wcswidth() variant that works on narrow strings. + * + * @param str + * The string to measure. + * @return + * The likely width of that string in a terminal. + */ +size_t xstrwidth(const char *str); + /** * Return whether an error code is due to a path not existing. */ -- cgit v1.2.3