Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize display width handling #123

Open
eugene-bulkin opened this issue Dec 24, 2019 · 0 comments
Open

Customize display width handling #123

eugene-bulkin opened this issue Dec 24, 2019 · 0 comments

Comments

@eugene-bulkin
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant