##// END OF EJS Templates
encoding: make sure "wide" variable never be referenced from other modules...
Yuya Nishihara -
r32537:044f3d7e default
parent child Browse files
Show More
@@ -194,8 +194,8 b' if not _nativeenviron:'
194 for k, v in os.environ.items()) # re-exports
194 for k, v in os.environ.items()) # re-exports
195
195
196 # How to treat ambiguous-width characters. Set to 'wide' to treat as wide.
196 # How to treat ambiguous-width characters. Set to 'wide' to treat as wide.
197 wide = _sysstr(environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide"
197 _wide = _sysstr(environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide"
198 and "WFA" or "WF")
198 and "WFA" or "WF")
199
199
200 def colwidth(s):
200 def colwidth(s):
201 "Find the column width of a string for display in the local encoding"
201 "Find the column width of a string for display in the local encoding"
@@ -205,7 +205,7 b' def ucolwidth(d):'
205 "Find the column width of a Unicode string for display"
205 "Find the column width of a Unicode string for display"
206 eaw = getattr(unicodedata, 'east_asian_width', None)
206 eaw = getattr(unicodedata, 'east_asian_width', None)
207 if eaw is not None:
207 if eaw is not None:
208 return sum([eaw(c) in wide and 2 or 1 for c in d])
208 return sum([eaw(c) in _wide and 2 or 1 for c in d])
209 return len(d)
209 return len(d)
210
210
211 def getcols(s, start, c):
211 def getcols(s, start, c):
General Comments 0
You need to be logged in to leave comments. Login now