diff --git a/src/PowerShellEditorServices/Services/PowerShellContext/Session/Host/EditorServicesPSHostUserInterface.cs b/src/PowerShellEditorServices/Services/PowerShellContext/Session/Host/EditorServicesPSHostUserInterface.cs
index 0d7812b1e..e84e3340a 100644
--- a/src/PowerShellEditorServices/Services/PowerShellContext/Session/Host/EditorServicesPSHostUserInterface.cs
+++ b/src/PowerShellEditorServices/Services/PowerShellContext/Session/Host/EditorServicesPSHostUserInterface.cs
@@ -804,8 +804,8 @@ private void WriteDebuggerBanner(DebuggerStopEventArgs eventArgs)
internal ConsoleColor VerboseForegroundColor { get; set; } = ConsoleColor.Yellow;
internal ConsoleColor VerboseBackgroundColor { get; set; } = BackgroundColor;
- internal ConsoleColor ProgressForegroundColor { get; set; } = ConsoleColor.Yellow;
- internal ConsoleColor ProgressBackgroundColor { get; set; } = ConsoleColor.DarkCyan;
+ internal virtual ConsoleColor ProgressForegroundColor { get; set; } = ConsoleColor.Yellow;
+ internal virtual ConsoleColor ProgressBackgroundColor { get; set; } = ConsoleColor.DarkCyan;
private async Task StartReplLoopAsync(CancellationToken cancellationToken)
{
diff --git a/src/PowerShellEditorServices/Services/PowerShellContext/Session/Host/TerminalPSHostUserInterface.cs b/src/PowerShellEditorServices/Services/PowerShellContext/Session/Host/TerminalPSHostUserInterface.cs
index 65043e38f..6a3e7de0d 100644
--- a/src/PowerShellEditorServices/Services/PowerShellContext/Session/Host/TerminalPSHostUserInterface.cs
+++ b/src/PowerShellEditorServices/Services/PowerShellContext/Session/Host/TerminalPSHostUserInterface.cs
@@ -22,7 +22,8 @@ internal class TerminalPSHostUserInterface : EditorServicesPSHostUserInterface
#region Private Fields
private readonly PSHostUserInterface internalHostUI;
- private ConsoleReadLine consoleReadLine;
+ private readonly PSObject _internalHostPrivateData;
+ private readonly ConsoleReadLine _consoleReadLine;
#endregion
@@ -44,8 +45,9 @@ public TerminalPSHostUserInterface(
new TerminalPSHostRawUserInterface(logger, internalHost),
logger)
{
- this.internalHostUI = internalHost.UI;
- this.consoleReadLine = new ConsoleReadLine(powerShellContext);
+ internalHostUI = internalHost.UI;
+ _internalHostPrivateData = internalHost.PrivateData;
+ _consoleReadLine = new ConsoleReadLine(powerShellContext);
// Set the output encoding to UTF-8 so that special
// characters are written to the console correctly
@@ -54,11 +56,11 @@ public TerminalPSHostUserInterface(
System.Console.CancelKeyPress +=
(obj, args) =>
{
- if (!this.IsNativeApplicationRunning)
+ if (!IsNativeApplicationRunning)
{
// We'll handle Ctrl+C
args.Cancel = true;
- this.SendControlC();
+ SendControlC();
}
};
}
@@ -70,6 +72,24 @@ public TerminalPSHostUserInterface(
///
internal protected override bool SupportsWriteProgress => true;
+ ///
+ /// Gets and sets the value of progress foreground from the internal host since Progress is handled there.
+ ///
+ internal override ConsoleColor ProgressForegroundColor
+ {
+ get => (ConsoleColor)_internalHostPrivateData.Properties["ProgressForegroundColor"].Value;
+ set => _internalHostPrivateData.Properties["ProgressForegroundColor"].Value = value;
+ }
+
+ ///
+ /// Gets and sets the value of progress background from the internal host since Progress is handled there.
+ ///
+ internal override ConsoleColor ProgressBackgroundColor
+ {
+ get => (ConsoleColor)_internalHostPrivateData.Properties["ProgressBackgroundColor"].Value;
+ set => _internalHostPrivateData.Properties["ProgressBackgroundColor"].Value = value;
+ }
+
///
/// Requests that the HostUI implementation read a command line
/// from the user to be executed in the integrated console command
@@ -81,7 +101,7 @@ public TerminalPSHostUserInterface(
/// A Task that can be awaited for the resulting input string.
protected override Task ReadCommandLineAsync(CancellationToken cancellationToken)
{
- return this.consoleReadLine.ReadCommandLineAsync(cancellationToken);
+ return _consoleReadLine.ReadCommandLineAsync(cancellationToken);
}
///
@@ -92,9 +112,9 @@ protected override Task ReadCommandLineAsync(CancellationToken cancellat
protected override InputPromptHandler OnCreateInputPromptHandler()
{
return new TerminalInputPromptHandler(
- this.consoleReadLine,
+ _consoleReadLine,
this,
- this.Logger);
+ Logger);
}
///
@@ -105,9 +125,9 @@ protected override InputPromptHandler OnCreateInputPromptHandler()
protected override ChoicePromptHandler OnCreateChoicePromptHandler()
{
return new TerminalChoicePromptHandler(
- this.consoleReadLine,
+ _consoleReadLine,
this,
- this.Logger);
+ Logger);
}
///
@@ -162,7 +182,7 @@ public override void WriteOutput(
///
protected override void WriteProgressImpl(long sourceId, ProgressRecord record)
{
- this.internalHostUI.WriteProgress(sourceId, record);
+ internalHostUI.WriteProgress(sourceId, record);
}
///