@@ -741,17 +741,15 @@ private void DoOneRepl(CancellationToken cancellationToken)
741741
742742 // If the user input was empty it's because:
743743 // - the user provided no input
744- // - the readline task was canceled
745- // - CtrlC was sent to readline (which does not propagate a cancellation)
744+ // - the ReadLine task was canceled
745+ // - CtrlC was sent to ReadLine (which does not propagate a cancellation)
746746 //
747- // In any event there's nothing to run in PowerShell, so we just loop back to the prompt again.
748- // However, we must distinguish the last two scenarios, since PSRL will not print a new line in those cases.
749- if ( string . IsNullOrEmpty ( userInput ) )
747+ // In any event there's nothing to run in PowerShell, so we just loop back to the
748+ // prompt again. However, PSReadLine will not print a newline for CtrlC, so we print
749+ // one, but we do not want to print one if the ReadLine task was canceled.
750+ if ( string . IsNullOrEmpty ( userInput ) && LastKeyWasCtrlC ( ) )
750751 {
751- if ( cancellationToken . IsCancellationRequested || LastKeyWasCtrlC ( ) )
752- {
753- UI . WriteLine ( ) ;
754- }
752+ UI . WriteLine ( ) ;
755753 return ;
756754 }
757755
@@ -813,19 +811,6 @@ private string GetPrompt(CancellationToken cancellationToken)
813811 return prompt ;
814812 }
815813
816- /// <summary>
817- /// This is used to write the invocation text of a command with the user's prompt so that,
818- /// for example, F8 (evaluate selection) appears as if the user typed it. Used when
819- /// 'WriteInputToHost' is true.
820- /// </summary>
821- /// <param name="command">The PSCommand we'll print after the prompt.</param>
822- /// <param name="cancellationToken"></param>
823- public void WriteWithPrompt ( PSCommand command , CancellationToken cancellationToken )
824- {
825- UI . Write ( GetPrompt ( cancellationToken ) ) ;
826- UI . WriteLine ( command . GetInvocationText ( ) ) ;
827- }
828-
829814 private string InvokeReadLine ( CancellationToken cancellationToken )
830815 {
831816 try
0 commit comments