Small fix for text color in console

This commit is contained in:
Bertrand Bellenot 2014-03-04 16:07:34 +01:00 committed by Axel Naumann
parent f67f118588
commit 94a6f1fb8e

View File

@ -21,8 +21,7 @@
namespace textinput {
TerminalDisplayWin::TerminalDisplayWin():
TerminalDisplay(false), fStartLine(0), fIsAttached(false),
fDefaultAttributes(0)
{
fDefaultAttributes(0) {
fOut = ::GetStdHandle(STD_OUTPUT_HANDLE);
bool isConsole = ::GetConsoleMode(fOut, &fOldMode) != 0;
SetIsTTY(isConsole);
@ -71,7 +70,12 @@ namespace textinput {
if (C.fR > 64) Attribs |= FOREGROUND_RED;
if (C.fG > 64) Attribs |= FOREGROUND_GREEN;
if (C.fB > 64) Attribs |= FOREGROUND_BLUE;
::SetConsoleTextAttribute(fOut, Attribs);
// if CIdx is 0 (default) then use the original console text color
// (instead of the greyish one)
if (CIdx == 0)
::SetConsoleTextAttribute(fOut, fDefaultAttributes);
else
::SetConsoleTextAttribute(fOut, Attribs);
}
void