timofurrer / colorful

Terminal string styling done right, in Python :snake: :tada:
MIT License
525 stars 23 forks source link

Nested placeholder remains in output #46

Open bra-fsn opened 3 years ago

bra-fsn commented 3 years ago

Describe the bug We use colorful for coloring output for scripts started from Jenkins (using the https://github.com/jenkinsci/ansicolor-plugin plugin). I'm not sure whether this is a bug or lack of support or both, but the effect is the following: this line logging.info(f"{colorful.bold_snow2(step.__name__)} starting") produces the following ASCII output: ESC[38;5;33m11:03:05ESC[0m ESC[38;5;68mINFOESC[0m ESC[38;5;75mworker_factory/mem:0B/473M/utime:0:ESC[0m ESC[38;5;253mESC[1mESC[38;5;231mDropNaESC[22mESC[39mESC[26m startingESC[0m which is displayed in Jenkins output as (and you can see the output is truncated, instead of starting, there's sta: image

It can be seen that an extra [26m (proportional spacing) is left, which can't be displayed (not supported?) by the Jenkins plugin. In the terminal this looks good. After looking into colorful's code, I'm not sure if it's not a bug (the [26m is there is mark nested borders, but it's left there).

Environment and Version

To Reproduce https://gist.github.com/bra-fsn/5f875a29bf043ae74748f2f9b2dbac81

Expected behavior I'm not sure, but I guess that [26m shouldn't be there.