@@ -35,7 +35,6 @@ public abstract class EditorServicesPSHostUserInterface :
3535 private readonly ConcurrentDictionary < ProgressKey , object > currentProgressMessages =
3636 new ConcurrentDictionary < ProgressKey , object > ( ) ;
3737
38- private readonly bool _isPSReadLineEnabled ;
3938 private PromptHandler activePromptHandler ;
4039 private PSHostRawUserInterface rawUserInterface ;
4140 private CancellationTokenSource commandLoopCancellationToken ;
@@ -106,13 +105,11 @@ public abstract class EditorServicesPSHostUserInterface :
106105 public EditorServicesPSHostUserInterface (
107106 PowerShellContextService powerShellContext ,
108107 PSHostRawUserInterface rawUserInterface ,
109- bool isPSReadLineEnabled ,
110108 ILogger logger )
111109 {
112110 this . Logger = logger ;
113111 this . powerShellContext = powerShellContext ;
114112 this . rawUserInterface = rawUserInterface ;
115- _isPSReadLineEnabled = isPSReadLineEnabled ;
116113
117114 this . powerShellContext . DebuggerStop += PowerShellContext_DebuggerStop ;
118115 this . powerShellContext . DebuggerResumed += PowerShellContext_DebuggerResumed ;
@@ -808,7 +805,6 @@ private async Task StartReplLoopAsync(CancellationToken cancellationToken)
808805 while ( ! cancellationToken . IsCancellationRequested )
809806 {
810807 string commandString = null ;
811- int originalCursorTop = 0 ;
812808
813809 try
814810 {
@@ -821,7 +817,6 @@ private async Task StartReplLoopAsync(CancellationToken cancellationToken)
821817
822818 try
823819 {
824- originalCursorTop = await ConsoleProxy . GetCursorTopAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
825820 commandString = await this . ReadCommandLineAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
826821 }
827822 catch ( PipelineStoppedException )
@@ -848,13 +843,14 @@ private async Task StartReplLoopAsync(CancellationToken cancellationToken)
848843 }
849844 finally
850845 {
851- // This supplies the newline in the Legacy ReadLine when executing code in the terminal via hitting the ENTER key.
852- // Without this, hitting ENTER with a no input looks like it does nothing (no new prompt is written)
846+ // This supplies the newline in the Legacy ReadLine when executing code in the terminal via hitting the ENTER key
847+ // or Ctrl+C. Without this, hitting ENTER with a no input looks like it does nothing (no new prompt is written)
853848 // and also the output would show up on the same line as the code you wanted to execute (the prompt line).
854- // Since PSReadLine handles ENTER internally to itself, we only want to do this when using the Legacy ReadLine.
855- if ( ! _isPSReadLineEnabled &&
856- ! cancellationToken . IsCancellationRequested &&
857- originalCursorTop == await ConsoleProxy . GetCursorTopAsync ( cancellationToken ) . ConfigureAwait ( false ) )
849+ // This is AlSO applied to PSReadLine for the Ctrl+C scenario which appears like it does nothing...
850+ // TODO: This still gives an extra newline when you hit ENTER in the PSReadLine experience. We should figure
851+ // out if there's any way to avoid that... but unfortunately, in both scenarios, we only see that empty
852+ // string is returned.
853+ if ( ! cancellationToken . IsCancellationRequested )
858854 {
859855 this . WriteLine ( ) ;
860856 }
0 commit comments