Use Environment.NewLine for new lines in ConsoleHost code (#9392)

This commit is contained in:
Ilya
2019-04-18 17:29:36 -07:00
committed by Dongbo Wang
parent f286c8ce63
commit 213ff96e6d
3 changed files with 8 additions and 8 deletions
@@ -1043,7 +1043,7 @@ namespace Microsoft.PowerShell
foreach (string s in Enum.GetNames(typeof(Serialization.DataFormat)))
{
sb.Append(s);
sb.Append(ConsoleHostUserInterface.Crlf);
sb.Append(Environment.NewLine);
}
++i;
@@ -2562,7 +2562,7 @@ namespace Microsoft.PowerShell
{
if (newLine)
{
WriteConsole(consoleHandle, ConsoleHostUserInterface.Crlf);
WriteConsole(consoleHandle, Environment.NewLine);
}
return;
@@ -2591,7 +2591,7 @@ namespace Microsoft.PowerShell
if (newLine)
{
var endOfLine = ConsoleHostUserInterface.Crlf.AsSpan();
var endOfLine = Environment.NewLine.AsSpan();
var endOfLineLength = endOfLine.Length;
Span<char> outBufferLine = stackalloc char[outBuffer.Length + endOfLineLength];
outBuffer.CopyTo(outBufferLine);
@@ -712,7 +712,7 @@ namespace Microsoft.PowerShell
if (newLine)
{
_parent.OutputSerializer.Serialize(Crlf);
_parent.OutputSerializer.Serialize(Environment.NewLine);
}
}
else
@@ -1152,7 +1152,7 @@ namespace Microsoft.PowerShell
sb.Append(s);
if (++count != lines.Count)
{
sb.Append(Crlf);
sb.Append(Environment.NewLine);
}
}
@@ -1344,7 +1344,7 @@ namespace Microsoft.PowerShell
{
Dbg.Assert(writer == _parent.ErrorSerializer.textWriter, "writers should be the same");
_parent.ErrorSerializer.Serialize(value + Crlf);
_parent.ErrorSerializer.Serialize(value + Environment.NewLine);
}
else
{
@@ -1612,7 +1612,7 @@ namespace Microsoft.PowerShell
#if UNIX
if (keyInfo.Key == ConsoleKey.Enter)
#else
if (s.EndsWith(Crlf, StringComparison.Ordinal))
if (s.EndsWith(Environment.NewLine, StringComparison.Ordinal))
#endif
{
result = ReadLineResult.endedOnEnter;
@@ -1620,7 +1620,7 @@ namespace Microsoft.PowerShell
// We're intercepting characters, so we need to echo the newline
Console.Out.WriteLine();
#else
s = s.Remove(s.Length - Crlf.Length);
s = s.Remove(s.Length - Environment.NewLine.Length);
#endif
break;
}