summaryrefslogtreecommitdiff
path: root/color.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-07-11 17:31:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-07-11 17:31:05 (GMT)
commit3c5de5c77b0718b47010b146160ecff6309f86b5 (patch)
tree10dfe3c6e701fab8fee60d0059a07b72cfd34c59 /color.h
parentbb2d8a817df91c68742e10ace2a791de176f7247 (diff)
parent9dc3515cf005639317fb95492b3157aadf056923 (diff)
downloadgit-3c5de5c77b0718b47010b146160ecff6309f86b5.zip
git-3c5de5c77b0718b47010b146160ecff6309f86b5.tar.gz
git-3c5de5c77b0718b47010b146160ecff6309f86b5.tar.bz2
Merge branch 'jk/ansi-color'
The output coloring scheme learned two new attributes, italic and strike, in addition to existing bold, reverse, etc. * jk/ansi-color: color: support strike-through attribute color: support "italic" attribute color: allow "no-" for negating attributes color: refactor parse_attr add skip_prefix_mem helper doc: refactor description of color format color: fix max-size comment
Diffstat (limited to 'color.h')
-rw-r--r--color.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/color.h b/color.h
index e155d13..6cae166 100644
--- a/color.h
+++ b/color.h
@@ -3,20 +3,23 @@
struct strbuf;
-/* 2 + (2 * num_attrs) + 8 + 1 + 8 + 'm' + NUL */
-/* "\033[1;2;4;5;7;38;5;2xx;48;5;2xxm\0" */
/*
* The maximum length of ANSI color sequence we would generate:
* - leading ESC '[' 2
- * - attr + ';' 3 * 10 (e.g. "1;")
+ * - attr + ';' 2 * num_attr (e.g. "1;")
+ * - no-attr + ';' 3 * num_attr (e.g. "22;")
* - fg color + ';' 17 (e.g. "38;2;255;255;255;")
* - bg color + ';' 17 (e.g. "48;2;255;255;255;")
* - terminating 'm' NUL 2
*
- * The above overcounts attr (we only use 5 not 8) and one semicolon
- * but it is close enough.
+ * The above overcounts by one semicolon but it is close enough.
+ *
+ * The space for attributes is also slightly overallocated, as
+ * the negation for some attributes is the same (e.g., nobold and nodim).
+ *
+ * We allocate space for 7 attributes.
*/
-#define COLOR_MAXLEN 70
+#define COLOR_MAXLEN 75
/*
* IMPORTANT: Due to the way these color codes are emulated on Windows,