Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
51c44af
Initial implementation of StringDecorated for rendering ANSI
SteveL-MSFT Jul 15, 2020
0d2fd7c
add formatting for $PSStyle
SteveL-MSFT Oct 2, 2020
085bf18
Expand formatting for $PSStyle
SteveL-MSFT Oct 7, 2020
ab3a768
Move logic to decide on rendering to lower in the stack
SteveL-MSFT Oct 24, 2020
f2b9def
fix wrapping as experimentalfeature
SteveL-MSFT Oct 24, 2020
1a975e5
more codefactor fixes
SteveL-MSFT Oct 24, 2020
c1d495a
Fix test failures by defaulting to ANSI for pipeline
SteveL-MSFT Oct 25, 2020
c89f46f
Fix codacy issues
SteveL-MSFT Oct 25, 2020
b1a2911
Support host callbacks
SteveL-MSFT Nov 4, 2020
d42e495
Refactor ANSI detection to utils
SteveL-MSFT Nov 12, 2020
003af49
Refactor ANSI helpers to Utils class. Make OutputRendering stored st…
SteveL-MSFT Nov 25, 2020
165c3a9
fix build issue
SteveL-MSFT Nov 25, 2020
f90b6bb
fix PSStyle tests and defaults
SteveL-MSFT Nov 25, 2020
749d1a0
refactor tests to be testcases
SteveL-MSFT Nov 26, 2020
e48630e
fix test
SteveL-MSFT Nov 26, 2020
ef0dd17
integrate PSStyle with streams, remove support for Progress as colori…
SteveL-MSFT Nov 26, 2020
e7db75c
address Stefan's feedback delaying creation of plaintext
SteveL-MSFT Nov 26, 2020
adc58c0
fix build issue
SteveL-MSFT Nov 26, 2020
d87d94e
fix codefactor issues
SteveL-MSFT Nov 26, 2020
6a4f859
fix issue where redirected output should be plaintext
SteveL-MSFT Nov 30, 2020
354f889
add test hook to suppress output redirection
SteveL-MSFT Dec 1, 2020
a21121c
Update src/System.Management.Automation/FormatAndOutput/common/String…
SteveL-MSFT Dec 1, 2020
415b407
Update src/System.Management.Automation/FormatAndOutput/common/String…
SteveL-MSFT Dec 1, 2020
725f119
Update src/System.Management.Automation/FormatAndOutput/common/String…
SteveL-MSFT Dec 1, 2020
4202c42
address Staffan's feedback
SteveL-MSFT Dec 1, 2020
6f8c945
remove unused and incomplete substring() method
SteveL-MSFT Dec 1, 2020
b59a970
address Dongbo's feedback except for struct version of psstyle
SteveL-MSFT Dec 10, 2020
3ec1b64
address remaining feedback from Dongbo
SteveL-MSFT Dec 10, 2020
a614402
fix Codefactor issues
SteveL-MSFT Dec 10, 2020
30f91b0
Update src/System.Management.Automation/FormatAndOutput/common/PSStyl…
SteveL-MSFT Dec 10, 2020
bc5d01e
Update src/System.Management.Automation/FormatAndOutput/common/String…
SteveL-MSFT Dec 10, 2020
2ca41b9
Update src/System.Management.Automation/FormatAndOutput/common/String…
SteveL-MSFT Dec 10, 2020
12e2f4b
Update src/System.Management.Automation/FormatAndOutput/common/String…
SteveL-MSFT Dec 10, 2020
8cfb562
fix build issue after applying Dongbo's suggestions
SteveL-MSFT Dec 10, 2020
ff23cb8
make _plaintext nullable
SteveL-MSFT Dec 11, 2020
6554939
fix for when pwsh itself is redirected output
SteveL-MSFT Dec 11, 2020
f8f8b4c
fix codefactor issues
SteveL-MSFT Dec 11, 2020
56ff2c4
Fix formatting of streams and added tests
SteveL-MSFT Dec 11, 2020
e4dc572
fix codefactor issue
SteveL-MSFT Dec 11, 2020
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 @@ -696,6 +696,7 @@ private void WriteImpl(string value, bool newLine)
}

TextWriter writer = Console.IsOutputRedirected ? Console.Out : _parent.ConsoleTextWriter;
value = Utils.GetOutputString(value, isHost: true, SupportsVirtualTerminal, Console.IsOutputRedirected);

if (_parent.IsRunningAsync)
{
Expand Down Expand Up @@ -1179,11 +1180,17 @@ public override void WriteDebugLine(string message)
}
else
{
// NTRAID#Windows OS Bugs-1061752-2004/12/15-sburns should read a skin setting here...
WriteLine(
DebugForegroundColor,
DebugBackgroundColor,
StringUtil.Format(ConsoleHostUserInterfaceStrings.DebugFormatString, message));
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled("PSAnsiRendering"))
{
WriteLine(Utils.GetFormatStyleString(Utils.FormatStyle.Debug) + StringUtil.Format(ConsoleHostUserInterfaceStrings.DebugFormatString, message));
}
else
{
WriteLine(
DebugForegroundColor,
DebugBackgroundColor,
StringUtil.Format(ConsoleHostUserInterfaceStrings.DebugFormatString, message));
}
}
}

Expand Down Expand Up @@ -1234,10 +1241,17 @@ public override void WriteVerboseLine(string message)
}
else
{
WriteLine(
VerboseForegroundColor,
VerboseBackgroundColor,
StringUtil.Format(ConsoleHostUserInterfaceStrings.VerboseFormatString, message));
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled("PSAnsiRendering"))
{
WriteLine(Utils.GetFormatStyleString(Utils.FormatStyle.Verbose) + StringUtil.Format(ConsoleHostUserInterfaceStrings.VerboseFormatString, message));
}
else
{
WriteLine(
VerboseForegroundColor,
VerboseBackgroundColor,
StringUtil.Format(ConsoleHostUserInterfaceStrings.VerboseFormatString, message));
}
}
}

Expand Down Expand Up @@ -1271,10 +1285,17 @@ public override void WriteWarningLine(string message)
}
else
{
WriteLine(
WarningForegroundColor,
WarningBackgroundColor,
StringUtil.Format(ConsoleHostUserInterfaceStrings.WarningFormatString, message));
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled("PSAnsiRendering"))
{
WriteLine(Utils.GetFormatStyleString(Utils.FormatStyle.Warning) + StringUtil.Format(ConsoleHostUserInterfaceStrings.WarningFormatString, message));
}
else
{
WriteLine(
WarningForegroundColor,
WarningBackgroundColor,
StringUtil.Format(ConsoleHostUserInterfaceStrings.WarningFormatString, message));
}
}
}

Expand Down Expand Up @@ -1334,9 +1355,20 @@ public override void WriteErrorLine(string value)
else
{
if (writer == _parent.ConsoleTextWriter)
WriteLine(ErrorForegroundColor, ErrorBackgroundColor, value);
{
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled("PSAnsiRendering"))
{
WriteLine(value);
}
else
{
WriteLine(ErrorForegroundColor, ErrorBackgroundColor, value);
}
}
else
{
Console.Error.WriteLine(value);
}
}
}

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Globalization;
using System.IO;
using System.Management.Automation;
using System.Management.Automation.Internal;
using System.Text;

// interfaces for host interaction
Expand Down Expand Up @@ -411,6 +412,9 @@ internal override int RowNumber
internal override void WriteLine(string s)
{
CheckStopProcessing();

s = Utils.GetOutputString(s, isHost: false);

if (_suppressNewline)
{
_writer.Write(s);
Expand Down
Loading