summaryrefslogtreecommitdiff
path: root/color.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-11-20 15:25:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-11-20 20:42:55 (GMT)
commitff40d185d25ce821bd6ae5a524e58e4eab01dc86 (patch)
tree680778bbebfd7fbd0a0b77757cfdec4f8ce280a4 /color.h
parent17a4be26060b00a867cbe54ee906fe03813470ec (diff)
downloadgit-ff40d185d25ce821bd6ae5a524e58e4eab01dc86.zip
git-ff40d185d25ce821bd6ae5a524e58e4eab01dc86.tar.gz
git-ff40d185d25ce821bd6ae5a524e58e4eab01dc86.tar.bz2
parse_color: recognize "no$foo" to clear the $foo attribute
You can turn on ANSI text attributes like "reverse" by putting "reverse" in your color spec. However, you cannot ask to turn reverse off. For common cases, this does not matter. You would turn on "reverse" at the start of a colored section, and then clear all attributes with a "reset". However, you may wish to turn on some attributes, then selectively disable others. For example: git log --format="%C(bold ul yellow)%h%C(noul) %s" underlines just the hash, but without the need to re-specify the rest of the attributes. This can also help third-party programs, like contrib/diff-highlight, that want to turn some attribute on/off without disrupting existing coloring. Note that some attribute specifications are probably nonsensical (e.g., "bold nobold"). We do not bother to flag such constructs, and instead let the terminal sort it out. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'color.h')
-rw-r--r--color.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/color.h b/color.h
index 4ec34b4..7fe77fb 100644
--- a/color.h
+++ b/color.h
@@ -8,7 +8,7 @@ struct strbuf;
/*
* The maximum length of ANSI color sequence we would generate:
* - leading ESC '[' 2
- * - attr + ';' 2 * 8 (e.g. "1;")
+ * - attr + ';' 3 * 10 (e.g. "1;")
* - fg color + ';' 17 (e.g. "38;2;255;255;255;")
* - bg color + ';' 17 (e.g. "48;2;255;255;255;")
* - terminating 'm' NUL 2
@@ -16,7 +16,7 @@ struct strbuf;
* The above overcounts attr (we only use 5 not 8) and one semicolon
* but it is close enough.
*/
-#define COLOR_MAXLEN 56
+#define COLOR_MAXLEN 70
/*
* IMPORTANT: Due to the way these color codes are emulated on Windows,