about summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2018-11-08 11:01:36 +0100
committerOliver Kiddle <okiddle@yahoo.co.uk>2018-11-08 11:01:36 +0100
commit5a7070178826e7b0db94e0a3d285849315e5c5ab (patch)
treea591eb8b149de6854c0e877d87878c4f4096e3fa /Src/Modules
parent9eba4d3a4417ce0e4e8d138376e86d831a889936 (diff)
downloadzsh-5a7070178826e7b0db94e0a3d285849315e5c5ab.tar.gz
zsh-5a7070178826e7b0db94e0a3d285849315e5c5ab.tar.xz
zsh-5a7070178826e7b0db94e0a3d285849315e5c5ab.zip
43805: make nearcolor module use the default colour rather than black as a fallback
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/nearcolor.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Src/Modules/nearcolor.c b/Src/Modules/nearcolor.c
index b51b4fd2c..0b9877bf4 100644
--- a/Src/Modules/nearcolor.c
+++ b/Src/Modules/nearcolor.c
@@ -146,13 +146,14 @@ mapRGBto256(int red, int green, int blue)
 static int
 getnearestcolor(UNUSED(Hookdef dummy), Color_rgb col)
 {
+    /* we add 1 to the colours so that colour 0 (black) is
+     * distinguished from runhookdef() indicating that no
+     * hook function is registered */
     if (tccolours == 256)
 	return mapRGBto256(col->red, col->green, col->blue) + 1;
     if (tccolours == 88)
 	return mapRGBto88(col->red, col->green, col->blue) + 1;
-    /* returning 1 indicates black rather than failure (0) so this
-     * module still serves to prevent fallback on true color */
-    return 1;
+    return -1;
 }
 
 static struct features module_features = {