mirror of
https://github.com/git/git.git
synced 2026-01-10 01:56:42 +00:00
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
This commit is contained in:
15
color.h
15
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,
|
||||
|
||||
Reference in New Issue
Block a user