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

Field alignment error when using "blessings" module #53

Closed
GoogleCodeExporter opened this issue Aug 11, 2015 · 1 comment
Closed

Field alignment error when using "blessings" module #53

GoogleCodeExporter opened this issue Aug 11, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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

  • Changed state: Fixed

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

No branches or pull requests

1 participant