Closed av-guy closed 2 months ago
Thanks for the PR!
Please could you:
- Update the title to be more descriptive? It will be used in the release notes. See https://github.com/jazzband/prettytable/releases to get an idea.
- Add "Fixes #xxx" with the issue number to the PR description, so the issue will be closed when this is merged.
- Add tests. It's good none of the existing tests fail. It will be even better to add tests which fail with current
main
and pass with this PR, so we can avoid regressions in the future.
I will try to get the tests done today. I did change the PR description. Does the new description satisfy the first two requirements in your list?
Looks good, except please move "Fixes #xxx" from the title to PR the description.
Looks good, except please move "Fixes #xxx" from the title to PR the description.
I added Fixes #290 to my original comment. I don't contribute very often, so if I did this wrong, please let me know.
Looks good, except please move "Fixes #xxx" from the title to PR the description.
I added a basic test for the color table. Please see commit df8f2e6 and provide feedback as necessary.
Fixes #290
The issue that the
ColorTable
is experiencing deals with its incorporation of ANSI escape character sequences. TheColorTable
class works by incorporating ANSI escape character sequences both before and after the character it represents. That creates a discrepancy in howPrettyTable
andColorTable
portray the same character.I altered how
_stringify_title
computes its width. Instead of relying onself._hrule
, it now uses the padding widths and the widths of the columns themselves. From my testing, this seems to work well. I also modified the way_stringify_header
slices thebits
value. The old code used hard values of1
and-1
, which doesn't account for the length of a single character when someone usesColorTable
.If you see anything that stands out, or you have input on a different solution, please let me know. I am open to the discussion. Also, I didn't see any tests related to the table rendering for
ColorTable
, so I didn't add any. All of the original tests are passing for bothColorTable
andPrettyTable
with these recent changes.