From 402972085a26c418a12d5c1c64f42cc60caf9207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 5 Jan 2022 22:15:39 +0100 Subject: [PATCH] main: include +/-wcwidth in version output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * +wcwidth: use our own, builtin, wcwidth() * -wcwidth: use system’s wcwidth() --- foot-features.h | 9 +++++++++ main.c | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/foot-features.h b/foot-features.h index ad447767..e5c8af7a 100644 --- a/foot-features.h +++ b/foot-features.h @@ -37,3 +37,12 @@ static inline bool feature_graphemes(void) return false; #endif } + +static inline bool feature_builtin_wcwidth(void) +{ +#if FOOT_SYSTEM_WCWIDTH == 0 + return true; +#else + return false; +#endif +} diff --git a/main.c b/main.c index 34f72a7c..b64b9d56 100644 --- a/main.c +++ b/main.c @@ -45,12 +45,13 @@ static const char * version_and_features(void) { static char buf[256]; - snprintf(buf, sizeof(buf), "version: %s %cpgo %cime %cgraphemes %cassertions", + snprintf(buf, sizeof(buf), "version: %s %cpgo %cime %cgraphemes %cassertions %cwcwidth", FOOT_VERSION, feature_pgo() ? '+' : '-', feature_ime() ? '+' : '-', feature_graphemes() ? '+' : '-', - feature_assertions() ? '+' : '-'); + feature_assertions() ? '+' : '-', + feature_builtin_wcwidth() ? '+' : '-'); return buf; }