@@ -320,7 +320,7 @@ void MaybeEmphasize(int i, string currColor)
320
320
}
321
321
322
322
currentLogicalLine += 1 ;
323
- if ( currentLogicalLine > _consoleBufferLines . Count - 1 )
323
+ if ( currentLogicalLine == _consoleBufferLines . Count )
324
324
{
325
325
_consoleBufferLines . Add ( new StringBuilder ( COMMON_WIDEST_CONSOLE_WIDTH ) ) ;
326
326
}
@@ -333,10 +333,7 @@ void MaybeEmphasize(int i, string currColor)
333
333
activeColor = string . Empty ;
334
334
335
335
UpdateColorsIfNecessary ( Options . _continuationPromptColor ) ;
336
- foreach ( char c in Options . ContinuationPrompt )
337
- {
338
- _consoleBufferLines [ currentLogicalLine ] . Append ( c ) ;
339
- }
336
+ _consoleBufferLines [ currentLogicalLine ] . Append ( Options . ContinuationPrompt ) ;
340
337
341
338
if ( inSelectedRegion )
342
339
{
@@ -365,6 +362,39 @@ void MaybeEmphasize(int i, string currColor)
365
362
_consoleBufferLines [ currentLogicalLine ] . Append ( "\x1b [0m" ) ;
366
363
}
367
364
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
+
368
398
if ( _statusLinePrompt != null )
369
399
{
370
400
currentLogicalLine += 1 ;
0 commit comments