The current implementation of character-level wrapping counts incoming characters and adds a new line if the length exceeds the terminal width.
This causes problems if the incoming data stream contains ANSI characters, for example:

There are several problems:
8;2;255;255;255m] to be displayed.@eth-p: I am mentioning you just for your information.
@sharkdp Good catch, I never considered that. I can think of two ways to fix this:
console::strip_ansi_codes.I would definitely like to support incoming ANSI codes, just like cat or less. This will be useful if people try to alias cat=bat or use bat as a general-purpose pager, etc. - so stripping ANSI codes is not really an option for me.
Also, I would really like to avoid having to implement a ANSI-code parser within bat. The console trait seems to have a few useful functions, for example: measure_text_width. Maybe we could utilize those... but I'm not sure if this is enough.
Perhaps console::AnsiCodeIterator would work? I'll play around with it and see what I can do.
There is also truncate_str, which seems really helpful!
Unfortunately, truncate_str doesn't allow me to get the text that was truncated. The source code for it used AnsiCodeIterator under the hood, so I ended up just borrowing the logic from that.