Skip to content

Commit 8311386

Browse files
committed
Color any prompt character when there is an error
cmder uses lambda as the prompt character which is a regular character, so I just removed the test and will color any random non-whitespace character that is used in the prompt. Fixes #180
1 parent 6aac7ec commit 8311386

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

PSReadLine/Changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Bug fixes:
1919
* Support CancelLine (Ctrl+C) and Abort (Ctrl+G in emacs) to cancel DigitArgument
2020
* History recall now ignores command lines from other currently running sessions, but you can
2121
still find command lines from those sessions when searching history.
22+
* Color any non-whitespace prompt character when there is an error, not just non-characters
2223

2324
New functions:
2425
* ValidateAndAcceptLine

PSReadLine/Render.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,11 @@ private void ReallyRender()
250250
continue;
251251
}
252252

253-
if (!char.IsLetterOrDigit(c))
254-
{
255-
ConsoleColor prevColor = _consoleBuffer[promptChar].ForegroundColor;
256-
_consoleBuffer[promptChar].ForegroundColor = ConsoleColor.Red;
257-
WriteBufferLines(_consoleBuffer, ref _initialY);
258-
rendered = true;
259-
_consoleBuffer[promptChar].ForegroundColor = prevColor;
260-
}
253+
ConsoleColor prevColor = _consoleBuffer[promptChar].ForegroundColor;
254+
_consoleBuffer[promptChar].ForegroundColor = ConsoleColor.Red;
255+
WriteBufferLines(_consoleBuffer, ref _initialY);
256+
rendered = true;
257+
_consoleBuffer[promptChar].ForegroundColor = prevColor;
261258
break;
262259
}
263260
}

0 commit comments

Comments
 (0)