8000 Use Environment.NewLine instead of Crlf by iSazonov · Pull Request #9392 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ private void ParseFormat(string[] args, ref int i, ref Serialization.DataFormat
foreach (string s in Enum.GetNames(typeof(Serialization.DataFormat)))
{
sb.Append(s);
sb.Append(ConsoleHostUserInterface.Crlf);
sb.Append(Environment.NewLine);
}

++i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2562,7 +2562,7 @@ internal static void WriteConsole(ConsoleHandle consoleHandle, ReadOnlySpan<char
{
if (newLine)
{
WriteConsole(consoleHandle, ConsoleHostUserInterface.Crlf);
WriteConsole(consoleHandle, Environment.NewLine);
}

return;
Expand Down Expand Up @@ -2591,7 +2591,7 @@ internal static void WriteConsole(ConsoleHandle consoleHandle, ReadOnlySpan<char

if (newLine)
{
var endOfLine = ConsoleHostUserInterface.Crlf.AsSpan();
var endOfLine = Environment.NewLine.AsSpan();
var endOfLineLength = endOfLine.Length;
Span<char> outBufferL 8000 ine = stackalloc char[outBuffer.Length + endOfLineLength];
outBuffer.CopyTo(outBufferLine);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ private void WriteImpl(string value, bool newLine)

if (newLine)
{
_parent.OutputSerializer.Serialize(Crlf);
_parent.OutputSerializer.Serialize(Environment.NewLine);
}
}
else
Expand Down Expand Up @@ -1152,7 +1152,7 @@ internal string WrapToCurrentWindowWidth(string text)
sb.Append(s);
if (++count != lines.Count)
{
sb.Append(Crlf);
sb.Append(Environment.NewLine);
}
}

Expand Down Expand Up @@ -1344,7 +1344,7 @@ public override void WriteErrorLine(string value)
{
Dbg.Assert(writer == _parent.ErrorSerializer.textWriter, "writers should be the same");

_parent.ErrorSerializer.Serialize(value + Crlf);
_parent.ErrorSerializer.Serialize(value + Environment.NewLine);
}
else
{
Expand Down Expand Up @@ -1612,15 +1612,15 @@ private string ReadLineFromConsole(bool endOnTab, string initialContent, bool ca
#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;
#if UNIX
// 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;
}
Expand Down
0