Skip to content

Customize display width handling #123

@eugene-bulkin

Description

@eugene-bulkin

This is almost similar to #46 and the work done in #106, but I think it should be somewhat genericized.

Specifically, I'm using prettytable for an IRC bot, and IRC uses a different kind of format for colors: /\x03([\d]{2}(,[\d]{2})?)?/ is a rough estimate of the regex involved, but essentially I may print something that, raw, looks like \x0313foo\x03, which shows up as foo but in pink. Notice that the two unprintable characters are fine here, but there are two usually printable characters (13) whose purpose is overriden and "eaten up" by the IRC client when formatting.

As a result, if I try to use this in a table, my columns will be missing two characters when it comes to padding because the display width is calculated to be 2 characters longer than it should be. Now, I don't think we should put an IRC color formatting regex in there for all purposes since not everyone would be using it. Perhaps it could be added as a crate feature?

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