about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-11 23:01:38 -0500
committerJune McEnroe <june@causal.agency>2020-02-11 23:01:38 -0500
commit8d873c71ede2ac1c0da4139d6fb9daf5d8c83f1e (patch)
tree60ec6eebb10a4a409b0e456ae2b34f49a9b142a8
parentAdd .gz to chroot-man script (diff)
downloadcatgirl-8d873c71ede2ac1c0da4139d6fb9daf5d8c83f1e.tar.gz
catgirl-8d873c71ede2ac1c0da4139d6fb9daf5d8c83f1e.zip
Support monochromatic terminals
Oops, division by zero!
-rw-r--r--ui.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ui.c b/ui.c
index 348dd84..12936ae 100644
--- a/ui.c
+++ b/ui.c
@@ -136,6 +136,7 @@ static short colorPairs;
 static void colorInit(void) {
 	start_color();
 	use_default_colors();
+	if (!COLORS) return;
 	for (short pair = 0; pair < 16; ++pair) {
 		init_pair(1 + pair, pair % COLORS, -1);
 	}
@@ -143,12 +144,14 @@ static void colorInit(void) {
 }
 
 static attr_t colorAttr(short fg) {
+	if (!COLORS) return (fg > 0 ? A_BOLD : A_NORMAL);
 	if (fg != COLOR_BLACK && fg % COLORS == COLOR_BLACK) return A_BOLD;
 	if (COLORS > 8) return A_NORMAL;
 	return (fg / COLORS & 1 ? A_BOLD : A_NORMAL);
 }
 
 static short colorPair(short fg, short bg) {
+	if (!COLORS) return 0;
 	fg %= COLORS;
 	bg %= COLORS;
 	if (bg == -1 && fg < 16) return 1 + fg;
light'> 2021-01-12Remove hacky tagging from hilexJune McEnroe God that makes the lexers so much simpler. 2021-01-12Add htagml -iJune McEnroe 2021-01-12Render tag index in HTMLJune McEnroe 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe This simplifies some things, adds support for line number tag definitions, and should enable combining htagml with other preprocessors in the future. 2021-01-12Split fields by tab onlyJune McEnroe Also don't fail hard on non-forward-search definitions. 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe neovim is laggy as hell in my OpenBSD VM, so I switched to vi so I could type without getting frustrated. 2021-01-09Add c -t flag to print expression typeJune McEnroe Also add missing float case. 2021-01-05Update taglineJune McEnroe