Show More
@@ -248,28 +248,19 b' def _modesetup(ui):' | |||
|
248 | 248 | if pycompat.iswindows: |
|
249 | 249 | from . import win32 |
|
250 | 250 | |
|
251 | term = encoding.environ.get(b'TERM') | |
|
252 | # TERM won't be defined in a vanilla cmd.exe environment. | |
|
253 | ||
|
254 | # UNIX-like environments on Windows such as Cygwin and MSYS will | |
|
255 | # set TERM. They appear to make a best effort attempt at setting it | |
|
256 | # to something appropriate. However, not all environments with TERM | |
|
257 | # defined support ANSI. | |
|
258 | ansienviron = term and b'xterm' in term | |
|
259 | ||
|
260 | 251 | if mode == b'auto': |
|
261 | 252 | # Since "ansi" could result in terminal gibberish, we error on the |
|
262 | 253 | # side of selecting "win32". However, if w32effects is not defined, |
|
263 | 254 | # we almost certainly don't support "win32", so don't even try. |
|
264 | 255 | # w32effects is not populated when stdout is redirected, so checking |
|
265 | 256 | # it first avoids win32 calls in a state known to error out. |
|
266 |
if |
|
|
257 | if not w32effects or win32.enablevtmode(): | |
|
267 | 258 | realmode = b'ansi' |
|
268 | 259 | else: |
|
269 | 260 | realmode = b'win32' |
|
270 | 261 | # An empty w32effects is a clue that stdout is redirected, and thus |
|
271 | 262 | # cannot enable VT mode. |
|
272 |
elif mode == b'ansi' and w32effects |
|
|
263 | elif mode == b'ansi' and w32effects: | |
|
273 | 264 | win32.enablevtmode() |
|
274 | 265 | elif mode == b'auto': |
|
275 | 266 | realmode = b'ansi' |
General Comments 0
You need to be logged in to leave comments.
Login now