templatefuncs: add truncate parameter to pad
Add a truncate option to pad that additionally truncates the text to the pad
width if it is wider.
Since color codes can cause a problem with this, when the text is truncated,
the color codes are also stripped. Users of the truncate option should label
the text outside the pad.
Differential Revision: https://phab.mercurial-scm.org/D5000