For text with color codes, how to wrap it to a fixed length in the terminal? Text without color codes wraps nicely with fold: But this red text wraps wrong: 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