diff options
author | Robert Estelle <robertestelle@gmail.com> | 2021-10-26 04:03:47 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-28 19:37:18 +0300 |
commit | de658515ae1166577441da09fe7624769e263a3e (patch) | |
tree | bd019e9daccc7e3f6340bccd4b3788434053ca80 /t/t4026-color.sh | |
parent | 05f1f41c9b02b916a5f03c5658bec3270ac3684d (diff) |
color: allow colors to be prefixed with "reset"
"reset" was previously treated as a standalone special color name
representing `\e[m`. Now, it can apply to other color properties,
allowing exact specifications without implicit attribute inheritance.
For example, "reset green" now renders `\e[;32m`, which is interpreted
as "reset everything; then set foreground to green". This means the
background and other attributes are also reset to their defaults.
Previously, this was impossible to represent in a single color:
"reset" could be specified alone, or a color with attributes, but some
thing like clearing a background color were impossible.
There is a separate change that introduces the "default" color name to
assist with that, but even then, the above could only to be represented
by explicitly disabling each of the attributes:
green default no-bold no-dim no-italic no-ul no-blink no-reverse no-strike
Signed-off-by: Robert Estelle <robertestelle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4026-color.sh')
-rwxr-xr-x | t/t4026-color.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/t/t4026-color.sh b/t/t4026-color.sh index d6907a66c3..cc3f60d468 100755 --- a/t/t4026-color.sh +++ b/t/t4026-color.sh @@ -60,6 +60,10 @@ test_expect_success 'fg bg attr...' ' color "blue bold dim ul blink reverse" "[1;2;4;5;7;34m" ' +test_expect_success 'reset fg bg attr...' ' + color "reset blue bold dim ul blink reverse" "[;1;2;4;5;7;34m" +' + # note that nobold and nodim are the same code (22) test_expect_success 'attr negation' ' color "nobold nodim noul noblink noreverse" "[22;24;25;27m" |