mercurial/encoding.py
changeset 15142 176882876780
parent 15066 24efa83d81cb
child 15143 16c129b0f465
equal deleted inserted replaced
15141:16dc9a32ca04 15142:176882876780
   137 # How to treat ambiguous-width characters. Set to 'wide' to treat as wide.
   137 # How to treat ambiguous-width characters. Set to 'wide' to treat as wide.
   138 wide = (os.environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide"
   138 wide = (os.environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide"
   139         and "WFA" or "WF")
   139         and "WFA" or "WF")
   140 
   140 
   141 def colwidth(s):
   141 def colwidth(s):
   142     "Find the column width of a UTF-8 string for display"
   142     "Find the column width of a string for display in the local encoding"
   143     return ucolwidth(s.decode(encoding, 'replace'))
   143     return ucolwidth(s.decode(encoding, 'replace'))
   144 
   144 
   145 def ucolwidth(d):
   145 def ucolwidth(d):
   146     "Find the column width of a Unicode string for display"
   146     "Find the column width of a Unicode string for display"
   147     eaw = getattr(unicodedata, 'east_asian_width', None)
   147     eaw = getattr(unicodedata, 'east_asian_width', None)