This can be easily reproduced by typing
print('\033[31mOK\033[0m\033[31mOK\033[0m\033[31mOK\033[0m\033[31mOK\033[0m\033[31mOK\033[0m\033[3
1mOK\033[0m\033[31mOK\033[0m\033[31mOK\033[0m\033[31mOK\033[0m\033[31mOK\033[0m\033[31mOK\033[0m\033[3
1mOK\033[0m\033[31mOK\033[0m\033[31mOK\033[0m\033[31mOK\033[0m')
In bpython

In Python

I guess when calculating the length of output, bpython counts all chars, but not all chars are visible, thus leading to this bug.
This can be easily reproduced by typing
In bpython

In Python

I guess when calculating the length of output, bpython counts all chars, but not all chars are visible, thus leading to this bug.