basic/glyph-util: introduce optional_glyph() to wrap emoji_enabled()

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-03-15 14:40:52 +01:00
parent 1ae9b0cfa8
commit 75d51d77da
3 changed files with 11 additions and 2 deletions
+5
View File
@@ -7,6 +7,7 @@
#include "macro.h"
typedef enum Glyph {
GLYPH_SPACE,
GLYPH_TREE_VERTICAL,
GLYPH_TREE_BRANCH,
GLYPH_TREE_RIGHT,
@@ -70,6 +71,10 @@ static inline const char* glyph(Glyph code) {
return glyph_full(code, false);
}
static inline const char* optional_glyph(Glyph code) {
return emoji_enabled() ? glyph(code) : "";
}
static inline const char* glyph_check_mark(bool b) {
return b ? glyph(GLYPH_CHECK_MARK) : glyph(GLYPH_CROSS_MARK);
}