##// END OF EJS Templates
color: don't infer vt status from TERM on Windows...
Mitchell Hentges -
r49587:fd2cf9e0 default
parent child Browse files
Show More
@@ -248,28 +248,19 b' def _modesetup(ui):'
248 if pycompat.iswindows:
248 if pycompat.iswindows:
249 from . import win32
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 if mode == b'auto':
251 if mode == b'auto':
261 # Since "ansi" could result in terminal gibberish, we error on the
252 # Since "ansi" could result in terminal gibberish, we error on the
262 # side of selecting "win32". However, if w32effects is not defined,
253 # side of selecting "win32". However, if w32effects is not defined,
263 # we almost certainly don't support "win32", so don't even try.
254 # we almost certainly don't support "win32", so don't even try.
264 # w32effects is not populated when stdout is redirected, so checking
255 # w32effects is not populated when stdout is redirected, so checking
265 # it first avoids win32 calls in a state known to error out.
256 # it first avoids win32 calls in a state known to error out.
266 if ansienviron or not w32effects or win32.enablevtmode():
257 if not w32effects or win32.enablevtmode():
267 realmode = b'ansi'
258 realmode = b'ansi'
268 else:
259 else:
269 realmode = b'win32'
260 realmode = b'win32'
270 # An empty w32effects is a clue that stdout is redirected, and thus
261 # An empty w32effects is a clue that stdout is redirected, and thus
271 # cannot enable VT mode.
262 # cannot enable VT mode.
272 elif mode == b'ansi' and w32effects and not ansienviron:
263 elif mode == b'ansi' and w32effects:
273 win32.enablevtmode()
264 win32.enablevtmode()
274 elif mode == b'auto':
265 elif mode == b'auto':
275 realmode = b'ansi'
266 realmode = b'ansi'
General Comments 0
You need to be logged in to leave comments. Login now