--- a/tests/test-template-functions.t Fri Oct 12 15:46:51 2018 +0000
+++ b/tests/test-template-functions.t Fri Oct 12 15:46:52 2018 +0000
@@ -696,6 +696,12 @@
> '{pad(label(red, "red"), 5, label(cyan, "-"))}\n'
\x1b[0;31mred\x1b[0m\x1b[0;36m-\x1b[0m\x1b[0;36m-\x1b[0m (esc)
+pad() with truncate has to strip color codes, though
+
+ $ hg debugtemplate --color=always \
+ > '{pad(label(red, "scarlet"), 5, truncate=true)}\n'
+ scarl
+
label should be no-op if color is disabled:
$ hg log --color=never -l 1 --template '{label(red, "text\n")}'
@@ -928,6 +934,15 @@
1------------------- {node|short}
0------------------- test
+ $ hg log --template '{pad(author, 5, "-", False, True)}\n'
+ test-
+ {node
+ test-
+ $ hg log --template '{pad(author, 5, "-", True, True)}\n'
+ -test
+ hort}
+ -test
+
Test template string in pad function
$ hg log -r 0 -T '{pad("\{{rev}}", 10)} {author|user}\n'