Public Member Functions | |
def | __init__ (self, width=80, subsequent_indent=" ", break_long_words=True, drop_whitespace=False, max_lines=None, placeholder=" ...", custom_widths=None) |
def | reserve_width (self, reserved="") |
def | strip (self, v) |
def | strlen (self, v) |
def | wrap (self, text) |
Public Attributes | |
break_long_words | |
custom_lens | |
custom_rgx | |
customs | |
disabled | |
drop_whitespace | |
lencache | |
max_lines | |
minwidth | |
placeholder | |
realwidth | |
subsequent_indent | |
width | |
Static Public Attributes | |
int | LENCACHEMAX = 10000 |
Max length of strlen cache. More... | |
SPACE_RGX = re.compile(r"([%s]+)" % re.escape("\t\n\x0b\x0c\r ")) | |
Regex for breaking text at whitespace. More... | |
Private Member Functions | |
def | _handle_long_word (self, reversed_chunks, cur_line, cur_len, width) |
def | _wrap_chunks (self, chunks) |
TextWrapper that supports custom substring widths in line width calculation. Intended for wrapping text containing ANSI control codes. Heavily refactored from Python standard library textwrap.TextWrapper.
def grepros.common.TextWrapper.__init__ | ( | self, | |
width = 80 , |
|||
subsequent_indent = " " , |
|||
break_long_words = True , |
|||
drop_whitespace = False , |
|||
max_lines = None , |
|||
placeholder = " ..." , |
|||
custom_widths = None |
|||
) |
@param width default maximum width to wrap at, 0 disables @param subsequent_indent string prepended to all consecutive lines @param break_long_words break words longer than width @param drop_whitespace drop leading and trailing whitespace from lines @param max_lines count to truncate lines from @param placeholder appended to last retained line when truncating @param custom_widths {substring: len} to use in line width calculation
|
private |
|
private |
def grepros.common.TextWrapper.reserve_width | ( | self, | |
reserved = "" |
|||
) |
def grepros.common.TextWrapper.strip | ( | self, | |
v | |||
) |
def grepros.common.TextWrapper.strlen | ( | self, | |
v | |||
) |
def grepros.common.TextWrapper.wrap | ( | self, | |
text | |||
) |
|
static |
|
static |