vsajip / prettytable

Automatically exported from code.google.com/p/prettytable
Other
0 stars 0 forks source link

Field alignment error when using "blessings" module #53

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using the blessings module:

https://pypi.python.org/pypi/blessings/

for coloring field contents.  It handles a lot of the ugliness of terminal 
escape codes, etc. nicely, but at least with my setup, I'm getting fields that 
are off by one character.

I've isolated the problem to the fact that blessings is adding a 0x0f (Ctrl-O) 
character as part of the term.normal() command that returns to the default 
formatting -- I believe this comes from the "sgr0" terminfo capability

The fix is to simply add 0x0f to the "special characters" in the 
_char_block_width() fuction, e.g.:

    # Other control characters
    elif char in (0x0000, 0x001f, 0x000f):
        return 0

Just wanted to note this as an issue so it can be fixed for anyone else using 
blessings and prettytable together.

Original issue reported on code.google.com by tonyc...@gmail.com on 16 May 2014 at 5:04

GoogleCodeExporter commented 9 years ago
Thanks for reporting this!  I've just fixed this in trunk, so it'll work fine 
in the next release.

Original comment by luke@maurits.id.au on 16 May 2014 at 10:29