Carriage return ignored/treated like line feed
Opened this issue · 1 comments
I ran across this processing the output from pytest. Its collection phase prints several messages, separating by carriage returns (0D). In the terminal, each of these lines overwrites the previous one, until it gets to the end of the phase, and then in does a line feed (0A). As a result, only the final line is visible. (I believe this only completely works because the lines are padded with spaces.)
When I feed this to ansi2html, every line is visible, as if they were all separated with line feeds.
I started this bug report all gung-ho about "We should fix it, I'll try to submit a pull request" but now that I more fully understand what's going on, I think the prudent thing would be to just document this behavior.
Edit: I talked to someone else, and actually, this might be doable. I'll try to hack something over the weekend.
I agree this is worth improving OR documenting.
For anyone interested, here's how to see it in action:
# echo $'ONE\nTWO\nTHREEEEEE\rFOUR\rFIVE\nSIX\n' | ansi2html --inline | tee /dev/stderr | hexdump -C
ONE
TWO
FIVEEEEEE
SIX
00000000 4f 4e 45 0a 54 57 4f 0a 54 48 52 45 45 45 45 45 |ONE.TWO.THREEEEE|
00000010 45 0d 46 4f 55 52 0d 46 49 56 45 0a 53 49 58 0a |E.FOUR.FIVE.SIX.|
00000020 0a |.|
00000021