Show More
@@ -260,7 +260,7 b' def configstyles(ui):' | |||
|
260 | 260 | if cfgeffects: |
|
261 | 261 | good = [] |
|
262 | 262 | for e in cfgeffects: |
|
263 | if valideffect(e): | |
|
263 | if valideffect(ui, e): | |
|
264 | 264 | good.append(e) |
|
265 | 265 | else: |
|
266 | 266 | ui.warn(_("ignoring unknown color/effect %r " |
@@ -268,13 +268,13 b' def configstyles(ui):' | |||
|
268 | 268 | % (e, status)) |
|
269 | 269 | _styles[status] = ' '.join(good) |
|
270 | 270 | |
|
271 | def valideffect(effect): | |
|
271 | def valideffect(ui, effect): | |
|
272 | 272 | 'Determine if the effect is valid or not.' |
|
273 | 273 | return ((not _terminfo_params and effect in _effects) |
|
274 | 274 | or (effect in _terminfo_params |
|
275 | 275 | or effect[:-11] in _terminfo_params)) |
|
276 | 276 | |
|
277 | def _effect_str(effect): | |
|
277 | def _effect_str(ui, effect): | |
|
278 | 278 | '''Helper function for render_effects().''' |
|
279 | 279 | |
|
280 | 280 | bg = False |
@@ -295,14 +295,14 b' def _effect_str(effect):' | |||
|
295 | 295 | else: |
|
296 | 296 | return curses.tparm(curses.tigetstr('setaf'), val) |
|
297 | 297 | |
|
298 | def _render_effects(text, effects): | |
|
298 | def _render_effects(ui, text, effects): | |
|
299 | 299 | 'Wrap text in commands to turn on each effect.' |
|
300 | 300 | if not text: |
|
301 | 301 | return text |
|
302 | 302 | if _terminfo_params: |
|
303 | start = ''.join(_effect_str(effect) | |
|
303 | start = ''.join(_effect_str(ui, effect) | |
|
304 | 304 | for effect in ['none'] + effects.split()) |
|
305 | stop = _effect_str('none') | |
|
305 | stop = _effect_str(ui, 'none') | |
|
306 | 306 | else: |
|
307 | 307 | start = [str(_effects[e]) for e in ['none'] + effects.split()] |
|
308 | 308 | start = '\033[' + ';'.join(start) + 'm' |
@@ -323,11 +323,11 b' def colorlabel(ui, msg, label):' | |||
|
323 | 323 | s = _styles.get(l, '') |
|
324 | 324 | if s: |
|
325 | 325 | effects.append(s) |
|
326 | elif valideffect(l): | |
|
326 | elif valideffect(ui, l): | |
|
327 | 327 | effects.append(l) |
|
328 | 328 | effects = ' '.join(effects) |
|
329 | 329 | if effects: |
|
330 | msg = '\n'.join([_render_effects(line, effects) | |
|
330 | msg = '\n'.join([_render_effects(ui, line, effects) | |
|
331 | 331 | for line in msg.split('\n')]) |
|
332 | 332 | return msg |
|
333 | 333 |
General Comments 0
You need to be logged in to leave comments.
Login now