For text with color codes, how to wrap it to a fixed length in the terminal?
Text without color codes wraps nicely with fold:
echo -e "12345678901234567890" | fold -w 10
1234567890
1234567890
But this red text wraps wrong:
echo -e "\u001b[31m12345678901234567890" | fold -w 10
12345
6789012345
67890
Note: While the red text is wrapped wrong, it still is printed in red, which is the desired behavior.
(My use case is line wrapping the output of git log --color=always --oneline --graph.)
