X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=color.h;h=90627650fccc67c31261977a22544af131812bd1;hb=c8a3ec37abe5395e4f4c14d5e9f0ab8077140f1b;hp=b9ead166b94e6bbf3bfcd25ff334caed9120927c;hpb=f34d900aa7346592a9d7fd2eb7b21126fd9732d5;p=git-core%2Fgit.git diff --git a/color.h b/color.h index b9ead166b..90627650f 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 #define GIT_COLOR_NORMAL "" #define GIT_COLOR_RESET "\033[m"