Setting the value can_change_color_palette in FTermcapQuirks

This commit is contained in:
Markus Gans 2018-10-29 21:12:03 +01:00
parent ce9d05ec7b
commit d35c3c0cdc
4 changed files with 22 additions and 0 deletions

View File

@ -1,6 +1,7 @@
2018-10-29 Markus Gans <guru.mail@muenster.de> 2018-10-29 Markus Gans <guru.mail@muenster.de>
* FTerm is now a data member of FVTerm * FTerm is now a data member of FVTerm
* Fix FListBox prevListItem() * Fix FListBox prevListItem()
* Setting the value can_change_color_palette in FTermcapQuirks
2018-10-26 Markus Gans <guru.mail@muenster.de> 2018-10-26 Markus Gans <guru.mail@muenster.de>
* Building Fix for a negative value check (gcc < 4.8) * Building Fix for a negative value check (gcc < 4.8)

View File

@ -261,6 +261,8 @@ void booleans()
std::cout << "\r\n[Booleans]\r\n"; std::cout << "\r\n[Booleans]\r\n";
tcapBoolean ( "background_color_erase" tcapBoolean ( "background_color_erase"
, finalcut::FTermcap::background_color_erase ); , finalcut::FTermcap::background_color_erase );
tcapBoolean ( "can_change_color_palette"
, finalcut::FTermcap::can_change_color_palette );
tcapBoolean ( "automatic_left_margin" tcapBoolean ( "automatic_left_margin"
, finalcut::FTermcap::automatic_left_margin ); , finalcut::FTermcap::automatic_left_margin );
tcapBoolean ( "automatic_right_margin" tcapBoolean ( "automatic_right_margin"

View File

@ -228,6 +228,7 @@ void FTermcapQuirks::xterm()
// Fallback if "Ic" is not found // Fallback if "Ic" is not found
if ( ! TCAP(fc::t_initialize_color) ) if ( ! TCAP(fc::t_initialize_color) )
{ {
FTermcap::can_change_color_palette = true;
TCAP(fc::t_initialize_color) = \ TCAP(fc::t_initialize_color) = \
C_STR(OSC "4;%p1%d;rgb:" C_STR(OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/" "%p2%{255}%*%{1000}%/%2.2X/"
@ -397,6 +398,8 @@ void FTermcapQuirks::screen()
// Fallback if "Ic" is not found // Fallback if "Ic" is not found
if ( ! TCAP(fc::t_initialize_color) ) if ( ! TCAP(fc::t_initialize_color) )
{ {
FTermcap::can_change_color_palette = true;
if ( term_detection->isTmuxTerm() ) if ( term_detection->isTmuxTerm() )
{ {
TCAP(fc::t_initialize_color) = \ TCAP(fc::t_initialize_color) = \
@ -440,6 +443,7 @@ void FTermcapQuirks::general()
// Fallback if "Ic" is not found // Fallback if "Ic" is not found
if ( ! TCAP(fc::t_initialize_color) ) if ( ! TCAP(fc::t_initialize_color) )
{ {
FTermcap::can_change_color_palette = true;
TCAP(fc::t_initialize_color) = \ TCAP(fc::t_initialize_color) = \
C_STR(OSC "P%p1%x" C_STR(OSC "P%p1%x"
"%p2%{255}%*%{1000}%/%02x" "%p2%{255}%*%{1000}%/%02x"

View File

@ -236,6 +236,7 @@ void FTermcapQuirksTest::generalTest()
finalcut::FTermData data; finalcut::FTermData data;
finalcut::FTermcap::tabstop = -1; finalcut::FTermcap::tabstop = -1;
finalcut::FTermcap::attr_without_color = -1; finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcap::can_change_color_palette = false;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
quirks.setTermData(&data); quirks.setTermData(&data);
@ -244,6 +245,7 @@ void FTermcapQuirksTest::generalTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::tabstop == 8 ); CPPUNIT_ASSERT ( finalcut::FTermcap::tabstop == 8 );
CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 ); CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 );
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string
, C_STR(CSI "3%p1%dm") ); , C_STR(CSI "3%p1%dm") );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string
@ -301,12 +303,14 @@ void FTermcapQuirksTest::xtermTest()
finalcut::FTermData data; finalcut::FTermData data;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
finalcut::FTermcap::can_change_color_palette = false;
detect.setXTerminal (true); detect.setXTerminal (true);
data.setTermType ("xterm"); data.setTermType ("xterm");
quirks.setTermData(&data); quirks.setTermData(&data);
quirks.setFTermDetection (&detect); quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string
, C_STR(OSC "4;%p1%d;rgb:" , C_STR(OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/" "%p2%{255}%*%{1000}%/%2.2X/"
@ -540,6 +544,7 @@ void FTermcapQuirksTest::puttyTest()
finalcut::FTermData data; finalcut::FTermData data;
finalcut::FTermcap::background_color_erase = false; finalcut::FTermcap::background_color_erase = false;
finalcut::FTermcap::can_change_color_palette = false;
finalcut::FTermcap::osc_support = false; finalcut::FTermcap::osc_support = false;
finalcut::FTermcap::attr_without_color = -1; finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
@ -553,6 +558,12 @@ void FTermcapQuirksTest::puttyTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::background_color_erase == true ); CPPUNIT_ASSERT ( finalcut::FTermcap::background_color_erase == true );
CPPUNIT_ASSERT ( finalcut::FTermcap::osc_support == true ); CPPUNIT_ASSERT ( finalcut::FTermcap::osc_support == true );
CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 ); CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 );
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string
, C_STR(OSC "P%p1%x"
"%p2%{255}%*%{1000}%/%02x"
"%p3%{255}%*%{1000}%/%02x"
"%p4%{255}%*%{1000}%/%02x") );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string
, C_STR(CSI "%?%p1%{8}%<" , C_STR(CSI "%?%p1%{8}%<"
"%t3%p1%d" "%t3%p1%d"
@ -676,12 +687,14 @@ void FTermcapQuirksTest::screenTest()
finalcut::FTermData data; finalcut::FTermData data;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
finalcut::FTermcap::can_change_color_palette = false;
detect.setScreenTerm (true); detect.setScreenTerm (true);
data.setTermType ("screen-256color"); data.setTermType ("screen-256color");
quirks.setTermData(&data); quirks.setTermData(&data);
quirks.setFTermDetection (&detect); quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string
, C_STR(ESC "P" OSC "4;%p1%d;rgb:" , C_STR(ESC "P" OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/" "%p2%{255}%*%{1000}%/%2.2X/"
@ -690,8 +703,10 @@ void FTermcapQuirksTest::screenTest()
detect.setTmuxTerm (true); detect.setTmuxTerm (true);
caps[finalcut::fc::t_initialize_color].string = 0; caps[finalcut::fc::t_initialize_color].string = 0;
finalcut::FTermcap::can_change_color_palette = false;
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string
, C_STR(ESC "Ptmux;" ESC OSC "4;%p1%d;rgb:" , C_STR(ESC "Ptmux;" ESC OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/" "%p2%{255}%*%{1000}%/%2.2X/"