##// END OF EJS Templates
color: drop use of the 'global' keyword for _terminfo_params...
Pierre-Yves David -
r30650:ae37e395 default
parent child Browse files
Show More
@@ -197,7 +197,6 b" testedwith = 'ships-with-hg-core'"
197 def _terminfosetup(ui, mode):
197 def _terminfosetup(ui, mode):
198 '''Initialize terminfo data and the terminal if we're in terminfo mode.'''
198 '''Initialize terminfo data and the terminal if we're in terminfo mode.'''
199
199
200 global _terminfo_params
201 # If we failed to load curses, we go ahead and return.
200 # If we failed to load curses, we go ahead and return.
202 if not _terminfo_params:
201 if not _terminfo_params:
203 return
202 return
@@ -215,7 +214,7 b' def _terminfosetup(ui, mode):'
215 try:
214 try:
216 curses.setupterm()
215 curses.setupterm()
217 except curses.error as e:
216 except curses.error as e:
218 _terminfo_params = {}
217 _terminfo_params.clear()
219 return
218 return
220
219
221 for key, (b, e, c) in _terminfo_params.items():
220 for key, (b, e, c) in _terminfo_params.items():
@@ -232,11 +231,9 b' def _terminfosetup(ui, mode):'
232 if mode == "terminfo":
231 if mode == "terminfo":
233 ui.warn(_("no terminfo entry for setab/setaf: reverting to "
232 ui.warn(_("no terminfo entry for setab/setaf: reverting to "
234 "ECMA-48 color\n"))
233 "ECMA-48 color\n"))
235 _terminfo_params = {}
234 _terminfo_params.clear()
236
235
237 def _modesetup(ui, coloropt):
236 def _modesetup(ui, coloropt):
238 global _terminfo_params
239
240 if coloropt == 'debug':
237 if coloropt == 'debug':
241 return 'debug'
238 return 'debug'
242
239
@@ -281,13 +278,13 b' def _modesetup(ui, coloropt):'
281 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
278 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
282
279
283 if realmode == 'win32':
280 if realmode == 'win32':
284 _terminfo_params = {}
281 _terminfo_params.clear()
285 if not w32effects:
282 if not w32effects:
286 modewarn()
283 modewarn()
287 return None
284 return None
288 _effects.update(w32effects)
285 _effects.update(w32effects)
289 elif realmode == 'ansi':
286 elif realmode == 'ansi':
290 _terminfo_params = {}
287 _terminfo_params.clear()
291 elif realmode == 'terminfo':
288 elif realmode == 'terminfo':
292 _terminfosetup(ui, mode)
289 _terminfosetup(ui, mode)
293 if not _terminfo_params:
290 if not _terminfo_params:
General Comments 0
You need to be logged in to leave comments. Login now