Changeset 601

Show
Ignore:
Timestamp:
17/04/09 23:24:25 (17 months ago)
Author:
athomas
Message:

Renamed cprintstrip() to cstrip().

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cly/trunk/cly/console.py

    r600 r601  
    3535 
    3636__all__ = """ 
    37 cwrite getch cerror cfatal register_codec cinfo cjustify clen cprint cprintstrip 
    38 csplice cwarning cwraptext print_table rjustify termheight termwidth wraptoterm 
     37cwrite getch cerror cfatal register_codec cinfo cjustify clen cprint csplice 
     38cwarning cwraptext print_table rjustify termheight termwidth wraptoterm cstrip 
    3939cencode cdecode 
    4040""".split() 
     
    4545_decode_re = re.compile(r'\^([N0-7BU])|[^^]+|\^') 
    4646_encode_re = re.compile(r'\033(?:[^[]|$)|\033\[(.*?)m') 
    47 _cprint_strip = re.compile(r'\^([N0-7BU])') 
     47_cstrip_re = re.compile(r'\^([N0-7BU])') 
    4848_cwrap_re = re.compile(r'(\n)|(\s+)|((?:\^[N0-7BU]|\S)+\b[^\n^\w]*)|(.)') 
    4949_terminal_type = None 
     
    5757 
    5858def mono_cwrite(io, text): 
    59     io.write(_cprint_strip.sub('', text)) 
     59    io.write(_cstrip_re.sub('', text)) 
    6060 
    6161 
     
    336336 
    337337 
    338 def cprintstrip(*args): 
    339     """As with cprint, but strip colour codes.""" 
    340     return _cprint_strip.sub('', ' '.join(map(str, args))) 
     338def cstrip(text): 
     339    """Strip colour codes from text.""" 
     340    return _cstrip_re.sub('', text) 
    341341 
    342342 
    343343def clen(arg): 
    344344    """Return the length of arg after colour codes are stripped.""" 
    345     return len(cprintstrip(arg)) 
     345    return len(cstrip(arg)) 
    346346 
    347347