kragniz / kragniz/prettytable

table.align["xyz"] = "l" doesn't work when color is added ('\033[34mxyz\033[0m') to the header fields.

Open
#33 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
What steps will reproduce the problem?
1. Set header field to left table.align["xyz"] = "l"
2. Wrap header field with ansi colors table.header(['\033[34mxyz\033[0m'])
3. Print table

What is the expected output? What do you see instead?
All the values under field xyz should be aligned to the left, but they're
instead aligned at the center.

What version of the product are you using? On what operating system?
Python 2.7.2 OS X 10.8.4 prettytable (0.7.2)

Please provide any additional information below.
It would be a nice feature to be able to add color to fields and values.
```

Original issue reported on code.google.com by `SShagin...@gmail.com` on 21 Aug 2013 at 4:26

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue using the alignment and ANSI-colored header steps in the report, then trace the table formatting and width/alignment handling. Done means the xyz column remains left-aligned when its header contains color escape sequences, with the existing table output behavior preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.