mirror of
https://github.com/git/git.git
synced 2026-01-10 01:56:42 +00:00
color: allow multiple attributes
In configuration files (and "git config --color" command line), we
supported one and only one attribute after foreground and background
color. Accept combinations of attributes, e.g.
[diff.color]
old = red reverse bold
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
16
color.h
16
color.h
@@ -1,8 +1,20 @@
|
||||
#ifndef COLOR_H
|
||||
#define COLOR_H
|
||||
|
||||
/* "\033[1;38;5;2xx;48;5;2xxm\0" is 23 bytes */
|
||||
#define COLOR_MAXLEN 24
|
||||
/* 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 + ';' 2 * 8 (e.g. "1;")
|
||||
* - fg color + ';' 9 (e.g. "38;5;2xx;")
|
||||
* - fg color + ';' 9 (e.g. "48;5;2xx;")
|
||||
* - terminating 'm' NUL 2
|
||||
*
|
||||
* The above overcounts attr (we only use 5 not 8) and one semicolon
|
||||
* but it is close enough.
|
||||
*/
|
||||
#define COLOR_MAXLEN 40
|
||||
|
||||
/*
|
||||
* This variable stores the value of color.ui
|
||||
|
||||
Reference in New Issue
Block a user