comparison tests/test-command-template.t @ 31518:43d6ef658874

color: insert color code after every "\e[0m" (issue5413) This assumes the last color wins, tested in ANSI mode. I guess terminfo mode would work in the same way.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 18 Mar 2017 20:11:15 +0900
parents d4ec69ff652a
children 3725986b151a
comparison
equal deleted inserted replaced
31517:468bc8a1863d 31518:43d6ef658874
3346 color effect can be specified without quoting: 3346 color effect can be specified without quoting:
3347 3347
3348 $ hg log --color=always -l 1 --template '{label(red, "text\n")}' 3348 $ hg log --color=always -l 1 --template '{label(red, "text\n")}'
3349 \x1b[0;31mtext\x1b[0m (esc) 3349 \x1b[0;31mtext\x1b[0m (esc)
3350 3350
3351 color effects can be nested (issue5413)
3352
3353 $ hg debugtemplate --color=always \
3354 > '{label(red, "red{label(magenta, "ma{label(cyan, "cyan")}{label(yellow, "yellow")}genta")}")}\n'
3355 \x1b[0;31mred\x1b[0;35mma\x1b[0;36mcyan\x1b[0m\x1b[0;31m\x1b[0;35m\x1b[0;33myellow\x1b[0m\x1b[0;31m\x1b[0;35mgenta\x1b[0m (esc)
3356
3351 label should be no-op if color is disabled: 3357 label should be no-op if color is disabled:
3352 3358
3353 $ hg log --color=never -l 1 --template '{label(red, "text\n")}' 3359 $ hg log --color=never -l 1 --template '{label(red, "text\n")}'
3354 text 3360 text
3355 $ hg log --config extensions.color=! -l 1 --template '{label(red, "text\n")}' 3361 $ hg log --config extensions.color=! -l 1 --template '{label(red, "text\n")}'