##// END OF EJS Templates
encoding: default ambiguous character to narrow...
Matt Mackall -
r12866:eddc2030 stable
parent child Browse files
Show More
@@ -87,11 +87,17 b' def fromlocal(s):'
87 87 except LookupError, k:
88 88 raise error.Abort("%s, please check your locale settings" % k)
89 89
90 # How to treat ambiguous-width characters. Set to 'wide' to treat as wide.
91 ambiguous = os.environ.get("HGENCODINGAMBIGUOUS", "narrow")
92
90 93 def colwidth(s):
91 94 "Find the column width of a UTF-8 string for display"
92 95 d = s.decode(encoding, 'replace')
93 96 if hasattr(unicodedata, 'east_asian_width'):
97 wide = "WF"
98 if ambiguous == "wide":
99 wide = "WFA"
94 100 w = unicodedata.east_asian_width
95 return sum([w(c) in 'WFA' and 2 or 1 for c in d])
101 return sum([w(c) in wide and 2 or 1 for c in d])
96 102 return len(d)
97 103
@@ -24,6 +24,13 b' HGENCODINGMODE'
24 24 "ignore", which drops them. This setting can be overridden with
25 25 the --encodingmode command-line option.
26 26
27 HGENCODINGAMBIGUOUS
28 This sets Mercurial's behavior for handling characters with
29 "ambiguous" widths like accented Latin characters with East Asian
30 fonts. By default, Mercurial assumes ambiguous characters are
31 narrow, set this variable to "wide" if such characters cause
32 formatting problems.
33
27 34 HGMERGE
28 35 An executable to use for resolving merge conflicts. The program
29 36 will be executed with three arguments: local file, remote file,
General Comments 0
You need to be logged in to leave comments. Login now