summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-05 04:24:13 -0500
committerJune McEnroe <june@causal.agency>2020-02-05 04:24:13 -0500
commit6e679bdf26fa4dae651aade985155bd424761a3a (patch)
tree92eb50e7ec420e7431144e6e5246a52a5aa5344f
parentSend input as raw IRC in <debug> (diff)
downloadcatgirl-6e679bdf26fa4dae651aade985155bd424761a3a.tar.gz
catgirl-6e679bdf26fa4dae651aade985155bd424761a3a.zip
Modulo colors before comparing pairs
Otherwise a new pair is allocated every time a high color is requested.
-rw-r--r--ui.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ui.c b/ui.c
index 12205cc..894e04d 100644
--- a/ui.c
+++ b/ui.c
@@ -135,12 +135,14 @@ static attr_t colorAttr(short fg) {
 
 static short colorPair(short fg, short bg) {
 	if (bg == -1) return 1 + fg;
+	fg %= COLORS;
+	bg %= COLORS;
 	for (short pair = 17; pair < colorPairs; ++pair) {
 		short f, b;
 		pair_content(pair, &f, &b);
 		if (f == fg && b == bg) return pair;
 	}
-	init_pair(colorPairs, fg % COLORS, bg % COLORS);
+	init_pair(colorPairs, fg, bg);
 	return colorPairs++;
 }
 
>Add -x flag to titleJune McEnroe 2019-09-07Ignore SIGPIPE in relayJune McEnroe Allows restarting consumers safely. 2019-09-07Add A Memory Called EmpireJune McEnroe 2019-09-05Handle lack of Content-TypeJune McEnroe 2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe Oops, didn't see this. 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe