rburns / ansi-to-html

Convert ansi escaped text streams to html.
MIT License
357 stars 48 forks source link

Support windows style newline #62

Closed lior-chervinsky closed 5 years ago

lior-chervinsky commented 5 years ago

Problem description

-When handling Ansi escaped text came across the \r\n which is commonly used by windows to designate a newline. -Currently \r is simply ignored (treated as normal text)

Suggested Solution

This is a reference i found to elaborate on the issue from stackoverflow:

\r = CR (Carriage Return) → Used as a new line character in Mac OS before X \n = LF (Line Feed) → Used as a new line character in Unix/Mac OS X \r\n = CR + LF → Used as a new line character in Windows

Updated and Added two tests - when newline option is false and when it is true

rburns commented 5 years ago

thanks, the tests make it clearer what the effects are.