##// END OF EJS Templates
color: consolidate cut-and-paste code...
Jordi Gutiérrez Hermoso -
r24266:c14b1d34 default
parent child Browse files
Show More
@@ -251,12 +251,16 b' def _modesetup(ui, coloropt):'
251 else:
251 else:
252 realmode = 'ansi'
252 realmode = 'ansi'
253
253
254 def modewarn():
255 # only warn if color.mode was explicitly set and we're in
256 # an interactive terminal
257 if mode == realmode and ui.interactive():
258 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
259
254 if realmode == 'win32':
260 if realmode == 'win32':
255 _terminfo_params = {}
261 _terminfo_params = {}
256 if not w32effects:
262 if not w32effects:
257 if mode == 'win32' and ui.interactive():
263 modewarn()
258 # only warn if color.mode is explicitly set to win32
259 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
260 return None
264 return None
261 _effects.update(w32effects)
265 _effects.update(w32effects)
262 elif realmode == 'ansi':
266 elif realmode == 'ansi':
@@ -264,10 +268,8 b' def _modesetup(ui, coloropt):'
264 elif realmode == 'terminfo':
268 elif realmode == 'terminfo':
265 _terminfosetup(ui, mode)
269 _terminfosetup(ui, mode)
266 if not _terminfo_params:
270 if not _terminfo_params:
267 if mode == 'terminfo' and ui.interactive():
271 ## FIXME Shouldn't we return None in this case too?
268 ## FIXME Shouldn't we return None in this case too?
272 modewarn()
269 # only warn if color.mode is explicitly set to win32
270 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
271 realmode = 'ansi'
273 realmode = 'ansi'
272 else:
274 else:
273 return None
275 return None
General Comments 0
You need to be logged in to leave comments. Login now