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 |
|
|
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, |
@@ -166,13 +166,13 b' hg tags (latin-1)' | |||
|
166 | 166 | |
|
167 | 167 | $ HGENCODING=latin-1 hg tags |
|
168 | 168 | tip 5:093c6077d1c8 |
|
169 | � 3:ca661e7520de | |
|
169 | � 3:ca661e7520de | |
|
170 | 170 | |
|
171 | 171 | hg tags (utf-8) |
|
172 | 172 | |
|
173 | 173 | $ HGENCODING=utf-8 hg tags |
|
174 | 174 | tip 5:093c6077d1c8 |
|
175 | é 3:ca661e7520de | |
|
175 | é 3:ca661e7520de | |
|
176 | 176 | |
|
177 | 177 | hg branches (ascii) |
|
178 | 178 | |
@@ -183,13 +183,13 b' hg branches (ascii)' | |||
|
183 | 183 | hg branches (latin-1) |
|
184 | 184 | |
|
185 | 185 | $ HGENCODING=latin-1 hg branches |
|
186 | � 5:093c6077d1c8 | |
|
186 | � 5:093c6077d1c8 | |
|
187 | 187 | default 4:94db611b4196 (inactive) |
|
188 | 188 | |
|
189 | 189 | hg branches (utf-8) |
|
190 | 190 | |
|
191 | 191 | $ HGENCODING=utf-8 hg branches |
|
192 | é 5:093c6077d1c8 | |
|
192 | é 5:093c6077d1c8 | |
|
193 | 193 | default 4:94db611b4196 (inactive) |
|
194 | 194 | $ echo '[ui]' >> .hg/hgrc |
|
195 | 195 | $ echo 'fallbackencoding = koi8-r' >> .hg/hgrc |
General Comments 0
You need to be logged in to leave comments.
Login now