diff --git a/src/fterm.cpp b/src/fterm.cpp index 80a5f3f6..d34c65f6 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -1392,6 +1392,20 @@ void FTerm::init() // stop non-blocking stdin unsetNonBlockingInput(); + // Test if the terminal is a xterm + if ( strncmp(termtype, const_cast("xterm"), 5) == 0 + || strncmp(termtype, const_cast("Eterm"), 4) == 0 ) + xterm = true; + else + xterm = false; + + // Test for Linux console + if ( strncmp(termtype, const_cast("linux"), 5) == 0 + || strncmp(termtype, const_cast("con"), 3) == 0 ) + linux_terminal = true; + else + linux_terminal = false; + // set the new environment variable TERM if ( new_termtype ) { @@ -1399,18 +1413,6 @@ void FTerm::init() strncpy (termtype, new_termtype, strlen(new_termtype)+1); } - if ( strncmp(termtype, const_cast("xterm"), 5) == 0 - || strncmp(termtype, const_cast("Eterm"), 4) == 0 ) - xterm = true; - else - xterm = false; - - if ( strncmp(termtype, const_cast("linux"), 5) == 0 - || strncmp(termtype, const_cast("con"), 3) == 0 ) - linux_terminal = true; - else - linux_terminal = false; - // 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() { diff --git a/src/fterm.h b/src/fterm.h index 11cd14e2..c3d7d7d1 100644 --- a/src/fterm.h +++ b/src/fterm.h @@ -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();