python-arabic-reshaper
python-arabic-reshaper copied to clipboard
[FR] Support ANSI color codes
I am using this package to be able to use my terminal in the rare cases where some RTL text is involved. I currently have this script:
#!/usr/bin/env python3
import arabic_reshaper
import sys
from bidi.algorithm import get_display
text_to_be_reshaped = sys.stdin.read()
reshaped_text = arabic_reshaper.reshape(text_to_be_reshaped)
bidi_text = get_display(reshaped_text)
print(bidi_text, end='')
And it works great:
But it would be even more awesome if it could support ANSI color codes:
I am not sure this problem is by the reshaper or by the fact that get_display
is called on the text, could you write a unit test that fails with this case?