Color setting improvements

This commit is contained in:
Markus Gans 2015-10-24 00:49:56 +02:00
parent b9fa26965a
commit e0246d6d9e
2 changed files with 28 additions and 12 deletions

View File

@ -1392,25 +1392,27 @@ void FTerm::init()
// stop non-blocking stdin
unsetNonBlockingInput();
// set the new environment variable TERM
if ( new_termtype )
{
setenv(const_cast<char*>("TERM"), new_termtype, 1);
strncpy (termtype, new_termtype, strlen(new_termtype)+1);
}
// Test if the terminal is a xterm
if ( strncmp(termtype, const_cast<char*>("xterm"), 5) == 0
|| strncmp(termtype, const_cast<char*>("Eterm"), 4) == 0 )
xterm = true;
else
xterm = false;
// Test for Linux console
if ( strncmp(termtype, const_cast<char*>("linux"), 5) == 0
|| strncmp(termtype, const_cast<char*>("con"), 3) == 0 )
linux_terminal = true;
else
linux_terminal = false;
// set the new environment variable TERM
if ( new_termtype )
{
setenv(const_cast<char*>("TERM"), new_termtype, 1);
strncpy (termtype, new_termtype, strlen(new_termtype)+1);
}
// Initializes variables for the current terminal
init_termcaps();
init_vt100altChar();
@ -1541,6 +1543,7 @@ void FTerm::init()
resetColorMap();
saveColorMap();
setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Blue, 0x22, 0x22, 0xb2);
setPalette (fc::Cyan, 0x4a, 0x4a, 0xe4);
setPalette (fc::Red, 0xb2, 0x18, 0x18);
@ -1606,6 +1609,7 @@ void FTerm::finish()
setPalette (fc::LightBlue, 0x54, 0x54, 0xff);
setPalette (fc::LightGreen, 0x54, 0xff, 0x54);
resetXTermColors();
resetColorMap();
}
if ( mintty_terminal )
@ -2815,6 +2819,17 @@ void FTerm::setXTermHighlightBackground (const FString& hbg)
}
}
//----------------------------------------------------------------------
void FTerm::resetXTermColors()
{
// Reset the entire color table
if ( xterm )
{
putstringf ("\033]104\07");
fflush(stdout);
}
}
//----------------------------------------------------------------------
void FTerm::resetXTermForeground()
{

View File

@ -319,6 +319,7 @@ class FTerm
static void setXTermMouseForeground (const FString&);
static void setXTermMouseBackground (const FString&);
static void setXTermHighlightBackground (const FString&);
static void resetXTermColors();
static void resetXTermForeground();
static void resetXTermBackground();
static void resetXTermCursorColor();