-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
To support converting the newline to added the \r to two patterns :
one is the \r\n to add a newline when encountered
the other is the last pattern, which extracts the text itself without newlines or backspaces or escape char.
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
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
added the
\r
to two patterns :\r\n
to add a newline when encounteredThis 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 istrue