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

Use _str_block_width to calculate title width #232

Open
hwmq opened this issue Mar 11, 2023 · 1 comment
Open

Use _str_block_width to calculate title width #232

hwmq opened this issue Mar 11, 2023 · 1 comment

Comments

@hwmq
Copy link

hwmq commented Mar 11, 2023

title_width = len(options["title"]) + sum(

Since title width is currently computed using len, zero-width characters in the title contribute to table width. _str_block_width removes some escape codes before calculating width and returns a more appropriate value. I propose replace len(options["title"]) with _str_block_width(options["title"]).

@hugovk
Copy link
Member

hugovk commented Apr 10, 2023

Please fill out the template:

What did you do?

What did you expect to happen?

What actually happened?

What versions are you using?

  • OS:
  • Python:
  • PrettyTable:

Please include code that reproduces the issue.

The best reproductions are self-contained scripts with minimal dependencies.

# code goes here

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

2 participants