Currently, any ANSI escape sequences in node.name are considered in the width of the printed form of name.
This makes the tree line connections incorrect, and everything looks wrong.
I've managed to work around this via rendering to a string first (#9) and then simply using str.replace to replace the node name with the ANSI-decorated name, but this is very slow when the number of nodes is high.
It would be nice if, instead of or in addition to using len(name):
|
next_indent = '{0}{1}{2}'.format(indent, ' ' if 'up' in last else '│', ' ' * len(name_getter(current_node))) |
That there could also be a length_getter in addition to name_getter (which, of course, defaults to len(name))
Currently, any ANSI escape sequences in
node.nameare considered in the width of the printed form ofname.This makes the tree line connections incorrect, and everything looks wrong.
I've managed to work around this via rendering to a string first (#9) and then simply using
str.replaceto replace the node name with the ANSI-decorated name, but this is very slow when the number of nodes is high.It would be nice if, instead of or in addition to using
len(name):pptree/pptree/pptree.py
Line 54 in db4c2f2
That there could also be a
length_getterin addition toname_getter(which, of course, defaults tolen(name))