##// END OF EJS Templates
color: be more conservative about setting ANSI mode on Windows (BC)...
Gregory Szorc -
r24028:a78888d9 default
parent child Browse files
Show More
@@ -215,9 +215,23 b' def _modesetup(ui, coloropt):'
215 mode = ui.config('color', 'mode', 'auto')
215 mode = ui.config('color', 'mode', 'auto')
216 realmode = mode
216 realmode = mode
217 if mode == 'auto':
217 if mode == 'auto':
218 if os.name == 'nt' and 'TERM' not in os.environ:
218 if os.name == 'nt':
219 # looks line a cmd.exe console, use win32 API or nothing
219 term = os.environ.get('TERM')
220 realmode = 'win32'
220 # TERM won't be defined in a vanilla cmd.exe environment.
221 if not term:
222 realmode = 'win32'
223
224 # UNIX-like environments on Windows such as Cygwin and MSYS will
225 # set TERM. They appear to make a best effort attempt at setting it
226 # to something appropriate. However, not all environments with TERM
227 # defined support ANSI. Since "ansi" could result in terminal
228 # gibberish, we error on the side of selecting "win32". However, if
229 # w32effects is not defined, we almost certainly don't support
230 # "win32", so don't even try.
231 if 'xterm' in term or not w32effects:
232 realmode = 'ansi'
233 else:
234 realmode = 'win32'
221 else:
235 else:
222 realmode = 'ansi'
236 realmode = 'ansi'
223
237
General Comments 0
You need to be logged in to leave comments. Login now