Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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 @@ -572,7 +572,7 @@ public FileInfoFormatting()
/// <summary>
/// Gets or sets the rendering mode for output.
/// </summary>
public OutputRendering OutputRendering { get; set; } = OutputRendering.Ansi;
public OutputRendering OutputRendering { get; set; } = OutputRendering.Host;
SteveL-MSFT marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Gets value to turn off all attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,14 @@ private string PlainText
}
}

// graphics/color mode ESC[1;2;...m
private const string GraphicsRegex = @"(\x1b\[\d+(;\d+)*m)";

// CSI escape sequences
private const string CsiRegex = @"(\x1b\[\?\d+[hl])";

// replace regex with .NET 6 API once available
internal static readonly Regex AnsiRegex = new Regex(@"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])", RegexOptions.Compiled);
internal static readonly Regex AnsiRegex = new Regex($"{GraphicsRegex}|{CsiRegex}", RegexOptions.Compiled);

/// <summary>
/// Initializes a new instance of the <see cref="ValueStringDecorated"/> struct.
Expand Down
2 changes: 1 addition & 1 deletion 2 test/powershell/engine/Formatting/PSStyle.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Describe 'Tests for $PSStyle automatic variable' {

It '$PSStyle has correct default for OutputRendering' {
$PSStyle | Should -Not -BeNullOrEmpty
$PSStyle.OutputRendering | Should -BeExactly 'Ansi'
$PSStyle.OutputRendering | Should -BeExactly 'Host'
}

It '$PSStyle has correct defaults for style <key>' -TestCases (Get-TestCases $styleDefaults) {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.