@@ -22,7 +22,8 @@ internal class TerminalPSHostUserInterface : EditorServicesPSHostUserInterface
2222 #region Private Fields
2323
2424 private readonly PSHostUserInterface internalHostUI ;
25- private ConsoleReadLine consoleReadLine ;
25+ private readonly PSObject _internalHostPrivateData ;
26+ private readonly ConsoleReadLine _consoleReadLine ;
2627
2728 #endregion
2829
@@ -44,8 +45,9 @@ public TerminalPSHostUserInterface(
4445 new TerminalPSHostRawUserInterface ( logger , internalHost ) ,
4546 logger )
4647 {
47- this . internalHostUI = internalHost . UI ;
48- this . consoleReadLine = new ConsoleReadLine ( powerShellContext ) ;
48+ internalHostUI = internalHost . UI ;
49+ _internalHostPrivateData = internalHost . PrivateData ;
50+ _consoleReadLine = new ConsoleReadLine ( powerShellContext ) ;
4951
5052 // Set the output encoding to UTF-8 so that special
5153 // characters are written to the console correctly
@@ -54,11 +56,11 @@ public TerminalPSHostUserInterface(
5456 System . Console . CancelKeyPress +=
5557 ( obj , args ) =>
5658 {
57- if ( ! this . IsNativeApplicationRunning )
59+ if ( ! IsNativeApplicationRunning )
5860 {
5961 // We'll handle Ctrl+C
6062 args . Cancel = true ;
61- this . SendControlC ( ) ;
63+ SendControlC ( ) ;
6264 }
6365 } ;
6466 }
@@ -75,6 +77,24 @@ public TerminalPSHostUserInterface(
7577 /// </summary>
7678 internal protected override bool SupportsWriteProgress => true ;
7779
80+ /// <summary>
81+ /// Gets and sets the value of progress foreground from the internal host since Progress is handled there.
82+ /// </summary>
83+ internal override ConsoleColor ProgressForegroundColor
84+ {
85+ get => ( ConsoleColor ) _internalHostPrivateData . Properties [ "ProgressForegroundColor" ] . Value ;
86+ set => _internalHostPrivateData . Properties [ "ProgressForegroundColor" ] . Value = value ;
87+ }
88+
89+ /// <summary>
90+ /// Gets and sets the value of progress background from the internal host since Progress is handled there.
91+ /// </summary>
92+ internal override ConsoleColor ProgressBackgroundColor
93+ {
94+ get => ( ConsoleColor ) _internalHostPrivateData . Properties [ "ProgressBackgroundColor" ] . Value ;
95+ set => _internalHostPrivateData . Properties [ "ProgressBackgroundColor" ] . Value = value ;
96+ }
97+
7898 /// <summary>
7999 /// Requests that the HostUI implementation read a command line
80100 /// from the user to be executed in the integrated console command
@@ -86,7 +106,7 @@ public TerminalPSHostUserInterface(
86106 /// <returns>A Task that can be awaited for the resulting input string.</returns>
87107 protected override Task < string > ReadCommandLineAsync ( CancellationToken cancellationToken )
88108 {
89- return this . consoleReadLine . ReadCommandLineAsync ( cancellationToken ) ;
109+ return _consoleReadLine . ReadCommandLineAsync ( cancellationToken ) ;
90110 }
91111
92112 /// <summary>
@@ -97,9 +117,9 @@ protected override Task<string> ReadCommandLineAsync(CancellationToken cancellat
97117 protected override InputPromptHandler OnCreateInputPromptHandler ( )
98118 {
99119 return new TerminalInputPromptHandler (
100- this . consoleReadLine ,
120+ _consoleReadLine ,
101121 this ,
102- this . Logger ) ;
122+ Logger ) ;
103123 }
104124
105125 /// <summary>
@@ -110,9 +130,9 @@ protected override InputPromptHandler OnCreateInputPromptHandler()
110130 protected override ChoicePromptHandler OnCreateChoicePromptHandler ( )
111131 {
112132 return new TerminalChoicePromptHandler (
113- this . consoleReadLine ,
133+ _consoleReadLine ,
114134 this ,
115- this . Logger ) ;
135+ Logger ) ;
116136 }
117137
118138 /// <summary>
@@ -167,7 +187,7 @@ public override void WriteOutput(
167187 /// </param>
168188 protected override void WriteProgressImpl ( long sourceId , ProgressRecord record )
169189 {
170- this . internalHostUI . WriteProgress ( sourceId , record ) ;
190+ internalHostUI . WriteProgress ( sourceId , record ) ;
171191 }
172192
173193 /// <summary>
0 commit comments