Skip to content

Support for ANSI Escape sequences in name #11

@zachriggle

Description

@zachriggle

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions