mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Use ProgressView.Classic if Virtual Terminal is not supported (#15048)
This commit is contained in:
@@ -48,7 +48,7 @@ namespace Microsoft.PowerShell
|
||||
|
||||
_pendingProgress = null;
|
||||
|
||||
if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSAnsiProgressFeatureName) && PSStyle.Instance.Progress.UseOSCIndicator)
|
||||
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled(ExperimentalFeature.PSAnsiProgressFeatureName) && PSStyle.Instance.Progress.UseOSCIndicator)
|
||||
{
|
||||
// OSC sequence to turn off progress indicator
|
||||
// https://github.com/microsoft/terminal/issues/6700
|
||||
@@ -99,7 +99,7 @@ namespace Microsoft.PowerShell
|
||||
{
|
||||
// Update the progress pane only when the timer set up the update flag or WriteProgress is completed.
|
||||
// As a result, we do not block WriteProgress and whole script and eliminate unnecessary console locks and updates.
|
||||
if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSAnsiProgressFeatureName) && PSStyle.Instance.Progress.UseOSCIndicator)
|
||||
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled(ExperimentalFeature.PSAnsiProgressFeatureName) && PSStyle.Instance.Progress.UseOSCIndicator)
|
||||
{
|
||||
int percentComplete = record.PercentComplete;
|
||||
if (percentComplete < 0)
|
||||
@@ -114,6 +114,12 @@ namespace Microsoft.PowerShell
|
||||
Console.Write($"\x1b]9;4;1;{percentComplete}\x1b\\");
|
||||
}
|
||||
|
||||
// If VT is not supported, we change ProgressView to classic
|
||||
if (!SupportsVirtualTerminal && ExperimentalFeature.IsEnabled(ExperimentalFeature.PSAnsiProgressFeatureName))
|
||||
{
|
||||
PSStyle.Instance.Progress.View = ProgressView.Classic;
|
||||
}
|
||||
|
||||
_progPane.Show(_pendingProgress);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user