@@ -617,17 +617,15 @@ private void DoOneRepl(CancellationToken cancellationToken)
617617
618618 // If the user input was empty it's because:
619619 // - the user provided no input
620- // - the readline task was canceled
621- // - CtrlC was sent to readline (which does not propagate a cancellation)
620+ // - the ReadLine task was canceled
621+ // - CtrlC was sent to ReadLine (which does not propagate a cancellation)
622622 //
623- // In any event there's nothing to run in PowerShell, so we just loop back to the prompt again.
624- // However, we must distinguish the last two scenarios, since PSRL will not print a new line in those cases.
625- if ( string . IsNullOrEmpty ( userInput ) )
623+ // In any event there's nothing to run in PowerShell, so we just loop back to the
624+ // prompt again. However, PSReadLine will not print a newline for CtrlC, so we print
625+ // one, but we do not want to print one if the ReadLine task was canceled.
626+ if ( string . IsNullOrEmpty ( userInput ) && LastKeyWasCtrlC ( ) )
626627 {
627- if ( cancellationToken . IsCancellationRequested || LastKeyWasCtrlC ( ) )
628- {
629- UI . WriteLine ( ) ;
630- }
628+ UI . WriteLine ( ) ;
631629 return ;
632630 }
633631
@@ -679,19 +677,6 @@ private string GetPrompt(CancellationToken cancellationToken)
679677 return prompt ;
680678 }
681679
682- /// <summary>
683- /// This is used to write the invocation text of a command with the user's prompt so that,
684- /// for example, F8 (evaluate selection) appears as if the user typed it. Used when
685- /// 'WriteInputToHost' is true.
686- /// </summary>
687- /// <param name="command">The PSCommand we'll print after the prompt.</param>
688- /// <param name="cancellationToken"></param>
689- public void WriteWithPrompt ( PSCommand command , CancellationToken cancellationToken )
690- {
691- UI . Write ( GetPrompt ( cancellationToken ) ) ;
692- UI . WriteLine ( command . GetInvocationText ( ) ) ;
693- }
694-
695680 private string InvokeReadLine ( CancellationToken cancellationToken )
696681 {
697682 try
0 commit comments