@@ -320,7 +320,7 @@ void MaybeEmphasize(int i, string currColor)
320320 }
321321
322322 currentLogicalLine += 1 ;
323- if ( currentLogicalLine > _consoleBufferLines . Count - 1 )
323+ if ( currentLogicalLine == _consoleBufferLines . Count )
324324 {
325325 _consoleBufferLines . Add ( new StringBuilder ( COMMON_WIDEST_CONSOLE_WIDTH ) ) ;
326326 }
@@ -333,10 +333,7 @@ void MaybeEmphasize(int i, string currColor)
333333 activeColor = string . Empty ;
334334
335335 UpdateColorsIfNecessary ( Options . _continuationPromptColor ) ;
336- foreach ( char c in Options . ContinuationPrompt )
337- {
338- _consoleBufferLines [ currentLogicalLine ] . Append ( c ) ;
339- }
336+ _consoleBufferLines [ currentLogicalLine ] . Append ( Options . ContinuationPrompt ) ;
340337
341338 if ( inSelectedRegion )
342339 {
@@ -365,6 +362,39 @@ void MaybeEmphasize(int i, string currColor)
365362 _consoleBufferLines [ currentLogicalLine ] . Append ( "\x1b [0m" ) ;
366363 }
367364
365+ if ( suggestion != null )
366+ {
367+ // TODO: write suggestion out in dark black by default, but it needs to be configurable.
368+ color = "\x1b [90m" ;
369+ UpdateColorsIfNecessary ( color ) ;
370+
371+ foreach ( char charToRender in suggestion )
372+ {
373+ if ( charToRender == '\n ' )
374+ {
375+ currentLogicalLine += 1 ;
376+ if ( currentLogicalLine == _consoleBufferLines . Count )
377+ {
378+ _consoleBufferLines . Add ( new StringBuilder ( COMMON_WIDEST_CONSOLE_WIDTH ) ) ;
379+ }
380+
381+ _consoleBufferLines [ currentLogicalLine ] . Append ( Options . ContinuationPrompt ) ;
382+ }
383+ else
384+ {
385+ if ( char . IsControl ( charToRender ) )
386+ {
387+ _consoleBufferLines [ currentLogicalLine ] . Append ( '^' ) ;
388+ _consoleBufferLines [ currentLogicalLine ] . Append ( ( char ) ( '@' + charToRender ) ) ;
389+ }
390+ else
391+ {
392+ _consoleBufferLines [ currentLogicalLine ] . Append ( charToRender ) ;
393+ }
394+ }
395+ }
396+ }
397+
368398 if ( _statusLinePrompt != null )
369399 {
370400 currentLogicalLine += 1 ;
0 commit comments