colorclass icon indicating copy to clipboard operation
colorclass copied to clipboard

Slicing is not consistent between a regular string and a Colorclass string

Open kizbitz opened this issue 8 years ago • 0 comments

Python 2.7.13 (default, Jul 24 2017, 20:13:18)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from colorclass import Color

>>> s = 'This is a test string ...'
>>> c = Color('{autogreen}This is a test string ...{/autogreen}')

>>> print s
This is a test string ...
>>> print c
This is a test string ...
>>> print s[:14]
This is a test
>>> print c[:14]
This is a

# work around
>>> print c.value_colors.replace(c.value_no_colors, c.value_no_colors[:14])
This is a test

kizbitz avatar Nov 05 '17 17:11 kizbitz