mercurial/templater.py
changeset 31527 44c591f63458
parent 31526 6f150bb19317
child 31806 8f203b491bb5
equal deleted inserted replaced
31526:6f150bb19317 31527:44c591f63458
    11 import re
    11 import re
    12 import types
    12 import types
    13 
    13 
    14 from .i18n import _
    14 from .i18n import _
    15 from . import (
    15 from . import (
       
    16     color,
    16     config,
    17     config,
    17     encoding,
    18     encoding,
    18     error,
    19     error,
    19     minirst,
    20     minirst,
    20     parser,
    21     parser,
   574 
   575 
   575     left = False
   576     left = False
   576     fillchar = ' '
   577     fillchar = ' '
   577     if len(args) > 2:
   578     if len(args) > 2:
   578         fillchar = evalstring(context, mapping, args[2])
   579         fillchar = evalstring(context, mapping, args[2])
   579         if len(fillchar) != 1:
   580         if len(color.stripeffects(fillchar)) != 1:
   580             # i18n: "pad" is a keyword
   581             # i18n: "pad" is a keyword
   581             raise error.ParseError(_("pad() expects a single fill character"))
   582             raise error.ParseError(_("pad() expects a single fill character"))
   582     if len(args) > 3:
   583     if len(args) > 3:
   583         left = evalboolean(context, mapping, args[3])
   584         left = evalboolean(context, mapping, args[3])
   584 
   585 
   585     fillwidth = width - encoding.colwidth(text)
   586     fillwidth = width - encoding.colwidth(color.stripeffects(text))
   586     if fillwidth <= 0:
   587     if fillwidth <= 0:
   587         return text
   588         return text
   588     if left:
   589     if left:
   589         return fillchar * fillwidth + text
   590         return fillchar * fillwidth + text
   590     else:
   591     else: