-
Notifications
You must be signed in to change notification settings - Fork 56
Remove PSStyle if terminal does not support escape sequence #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Common/AzurePSCmdlet.cs
Outdated
if (null == PSStyle.SupportsVirtualTerminal) | ||
{ | ||
PSStyle.SupportsVirtualTerminal = Host.UI.SupportsVirtualTerminal; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is too specific to be put in AzurePSCmdlet. It should be in PSStyle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Host.UI.SupportsVirtualTerminal is a property of PSCmdlet, its value is unavailable beyond cmdlet.
@@ -20,6 +20,8 @@ namespace Microsoft.WindowsAzure.Commands.Common | |||
/// </summary> | |||
public sealed class PSStyle | |||
{ | |||
public static bool? SupportsVirtualTerminal = null; | |||
|
|||
/// <summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try something like this
public static bool IsEscapeSequenceSupported {
if (!_isEscapeSequenceSupported.HasValue) { _isEscapeSequenceSupported = Host.UI.SupportsVirtualTerminal; }
return _isEscapeSequenceSupported.Value;
}
private static bool? _isEscapeSequenceSupported = null;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add a change log somewhere for this change.
src/Common/ColorAndFormat/PSStyle.cs
Outdated
} | ||
|
||
/// <summary> | ||
/// This function should be invoked only in the Az.Accounts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// This function should be invoked only in the Az.Accounts. | |
/// Initializes default settings of PSStyle according to the environment. | |
/// Note: This function should be invoked only in Az.Accounts. |
src/Common/ColorAndFormat/PSStyle.cs
Outdated
@@ -20,6 +22,29 @@ namespace Microsoft.WindowsAzure.Commands.Common | |||
/// </summary> | |||
public sealed class PSStyle | |||
{ | |||
private static bool? _isEscapeSequenceSupported = null; | |||
|
|||
public static bool IsEscapeSequenceSupported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to make this public? Otherwise it can be private.
@dolauli thanks for asking. No change log is needed for common repo. could you help approve this PR if no other comments. |
Fix issue: Recent changes to Connect-AZAccount -DeviceCode cause display issues in the PowerShell ISE azure-powershell#24556
Group in Azure-PowerShell PR: [Account] Recent changes to Connect-AZAccount -DeviceCode cause display issues in the PowerShell ISE azure-powershell#25735
Current effect

Changed effect
