Remove Cygwin bold color quirks fix in FOptiAttr

This commit is contained in:
Markus Gans 2018-04-11 21:41:22 +02:00
parent 356879bc1a
commit 2f89a8e454
5 changed files with 57 additions and 92 deletions

View File

@ -1,3 +1,6 @@
2017-04-11 Markus Gans <guru.mail@muenster.de>
* Remove Cygwin bold color quirks fix in FOptiAttr
2017-04-08 Markus Gans <guru.mail@muenster.de> 2017-04-08 Markus Gans <guru.mail@muenster.de>
* Improved Linux terminal quirks * Improved Linux terminal quirks
* Improvement in class FOptiAttr * Improvement in class FOptiAttr

View File

@ -128,7 +128,7 @@ class FOptiAttr
void setMaxColor (const int&); void setMaxColor (const int&);
void setNoColorVideo (int); void setNoColorVideo (int);
void setDefaultColorSupport(); void setDefaultColorSupport();
void setCygwinTerminal(); void unsetDefaultColorSupport();
void set_enter_bold_mode (char[]); void set_enter_bold_mode (char[]);
void set_exit_bold_mode (char[]); void set_exit_bold_mode (char[]);
void set_enter_dim_mode (char[]); void set_enter_dim_mode (char[]);
@ -273,8 +273,6 @@ class FOptiAttr
bool colorChange (char_data*&, char_data*&); bool colorChange (char_data*&, char_data*&);
void resetColor (char_data*&); void resetColor (char_data*&);
void prevent_no_color_video_attributes (char_data*&, bool = false); void prevent_no_color_video_attributes (char_data*&, bool = false);
void preProcessing_cygwin_quirks (char_data*&);
void postProcessing_cygwin_quirks (char_data*&, char_data*&);
void deactivateAttributes (char_data*&, char_data*&); void deactivateAttributes (char_data*&, char_data*&);
void changeAttributeSGR (char_data*&, char_data*&); void changeAttributeSGR (char_data*&, char_data*&);
void changeAttributeSeparately (char_data*&, char_data*&); void changeAttributeSeparately (char_data*&, char_data*&);
@ -338,7 +336,6 @@ class FOptiAttr
bool alt_equal_pc_charset; bool alt_equal_pc_charset;
bool monochron; bool monochron;
bool fake_reverse; bool fake_reverse;
bool cygwin_terminal;
char attr_buf[8192]; char attr_buf[8192];
char* attr_ptr; char* attr_ptr;
}; };
@ -379,7 +376,7 @@ inline void FOptiAttr::setDefaultColorSupport()
{ ansi_default_color = true; } { ansi_default_color = true; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FOptiAttr::setCygwinTerminal() inline void FOptiAttr::unsetDefaultColorSupport()
{ cygwin_terminal = true; } { ansi_default_color = false; }
#endif // FOPTIATTR_H #endif // FOPTIATTR_H

View File

@ -75,7 +75,6 @@ FOptiAttr::FOptiAttr()
, alt_equal_pc_charset(false) , alt_equal_pc_charset(false)
, monochron(true) , monochron(true)
, fake_reverse(false) , fake_reverse(false)
, cygwin_terminal(false)
, attr_ptr(attr_buf) , attr_ptr(attr_buf)
{ {
attr_buf[0] = '\0'; attr_buf[0] = '\0';
@ -560,8 +559,6 @@ char* FOptiAttr::changeAttribute (char_data*& term, char_data*& next)
if ( ! ( switchOn() || switchOff() || colorChange(term, next) ) ) if ( ! ( switchOn() || switchOff() || colorChange(term, next) ) )
return 0; return 0;
preProcessing_cygwin_quirks(term);
if ( hasNoAttribute(next) ) if ( hasNoAttribute(next) )
{ {
deactivateAttributes (term, next); deactivateAttributes (term, next);
@ -1297,42 +1294,6 @@ inline void FOptiAttr::prevent_no_color_video_attributes ( char_data*& attr
} }
} }
//----------------------------------------------------------------------
inline void FOptiAttr::preProcessing_cygwin_quirks (char_data*& term)
{
// Cygwin bold color fix pre processing
if ( ! cygwin_terminal || ! term )
return;
if ( term->fg_color > 7 || term->bg_color > 7 )
{
// Reset blink and bold mode from colors > 7
char rst[] = CSI "m";
append_sequence (rst);
reset(term);
}
}
//----------------------------------------------------------------------
inline void FOptiAttr::postProcessing_cygwin_quirks ( char_data*& term
, char_data*& next )
{
// Cygwin bold color fix post processing
if ( ! cygwin_terminal )
return;
if ( next->attr.bit.bold )
setTermBold(term);
if ( next->attr.bit.reverse )
setTermReverse(term);
if ( next->attr.bit.standout )
setTermStandout(term);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FOptiAttr::deactivateAttributes ( char_data*& term inline void FOptiAttr::deactivateAttributes ( char_data*& term
, char_data*& next ) , char_data*& next )
@ -1398,10 +1359,7 @@ inline void FOptiAttr::changeAttributeSGR ( char_data*& term
setTermPCcharset(term); setTermPCcharset(term);
if ( colorChange(term, next) ) if ( colorChange(term, next) )
{
change_color(term, next); change_color(term, next);
postProcessing_cygwin_quirks(term, next);
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1411,10 +1369,7 @@ inline void FOptiAttr::changeAttributeSeparately ( char_data*& term
setAttributesOff(term); setAttributesOff(term);
if ( colorChange(term, next) ) if ( colorChange(term, next) )
{
change_color (term, next); change_color (term, next);
postProcessing_cygwin_quirks(term, next);
}
detectSwitchOn (term, next); // After reset all attributes detectSwitchOn (term, next); // After reset all attributes
setAttributesOn(term); setAttributesOn(term);

View File

@ -3625,18 +3625,16 @@ void FTerm::init_termcaps_cygwin_quirks()
TCAP(fc::t_enter_blink_mode) = \ TCAP(fc::t_enter_blink_mode) = \
C_STR(CSI "5m"); C_STR(CSI "5m");
// Set enable alternate character set for cygwin terminal
if ( ! TCAP(fc::t_enable_acs) )
TCAP(fc::t_enable_acs) = \
C_STR(ESC "(B" ESC ")0");
// Set background color erase for cygwin terminal // Set background color erase for cygwin terminal
FTermcap::background_color_erase = true; FTermcap::background_color_erase = true;
// Include the Linux console quirks // Include the Linux console quirks
init_termcaps_linux_quirks(); init_termcaps_linux_quirks();
// Avoid underline, blink and dim mode
FTermcap::attr_without_color = 26;
// Invisible mode is not supported
TCAP(fc::t_enter_secure_mode) = 0;
TCAP(fc::t_exit_secure_mode) = 0;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -3648,9 +3646,11 @@ void FTerm::init_termcaps_linux_quirks()
if ( FTermcap::max_color > 8 ) if ( FTermcap::max_color > 8 )
{ {
TCAP(fc::t_set_a_foreground) = \ TCAP(fc::t_set_a_foreground) = \
C_STR(CSI "3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;21%;m"); C_STR(CSI "3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;22%;m");
TCAP(fc::t_set_a_background) = \ TCAP(fc::t_set_a_background) = \
C_STR(CSI "4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m"); C_STR(CSI "4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m");
// Avoid underline, blink and dim mode
FTermcap::attr_without_color = 26;
} }
else else
{ {
@ -3658,20 +3658,35 @@ void FTerm::init_termcaps_linux_quirks()
C_STR(CSI "3%p1%dm"); C_STR(CSI "3%p1%dm");
TCAP(fc::t_set_a_background) = \ TCAP(fc::t_set_a_background) = \
C_STR(CSI "4%p1%dm"); C_STR(CSI "4%p1%dm");
// Avoid underline and dim mode
FTermcap::attr_without_color = 18;
} }
TCAP(fc::t_orig_pair) = \ // Set select graphic rendition attributes
C_STR(CSI "39;49;25m"); TCAP(fc::t_set_attributes) = \
C_STR(CSI "0"
"%?%p6%|%t;1%;"
"%?%p1%p3%|%t;7%;"
"%?%p4%t;5%;m"
"%?%p9%t\016%e\017%;");
TCAP(fc::t_exit_reverse_mode) = \ TCAP(fc::t_enter_alt_charset_mode) = C_STR("\016");
C_STR(CSI "27m"); TCAP(fc::t_exit_alt_charset_mode) = C_STR("\017");
TCAP(fc::t_exit_attribute_mode) = C_STR(CSI "0m\017");
TCAP(fc::t_exit_bold_mode) = C_STR(CSI "22m");
TCAP(fc::t_exit_blink_mode) = C_STR(CSI "25m");
TCAP(fc::t_exit_reverse_mode) = C_STR(CSI "27m");
TCAP(fc::t_exit_secure_mode) = 0;
TCAP(fc::t_exit_protected_mode) = 0;
TCAP(fc::t_exit_crossed_out_mode) = 0;
TCAP(fc::t_orig_pair) = C_STR(CSI "39;49;25m");
// Avoid underline and dim mode // Avoid underline and dim mode
TCAP(fc::t_enter_dim_mode) = 0; TCAP(fc::t_enter_dim_mode) = 0;
TCAP(fc::t_exit_dim_mode) = 0; TCAP(fc::t_exit_dim_mode) = 0;
TCAP(fc::t_enter_underline_mode) = 0; TCAP(fc::t_enter_underline_mode) = 0;
TCAP(fc::t_exit_underline_mode) = 0; TCAP(fc::t_exit_underline_mode) = 0;
FTermcap::attr_without_color = 18;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -4099,9 +4114,6 @@ void FTerm::init_OptiAttr()
if ( FTermcap::ansi_default_color ) if ( FTermcap::ansi_default_color )
opti_attr->setDefaultColorSupport(); opti_attr->setDefaultColorSupport();
if ( cygwin_terminal )
opti_attr->setCygwinTerminal();
opti_attr->initialize(); opti_attr->initialize();
} }

View File

@ -688,8 +688,6 @@ int FVTerm::print (term_area* area, char_data& term_char)
return 1; return 1;
} }
//----------------------------------------------------------------------
// protected methods of FVTerm // protected methods of FVTerm
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FVTerm::term_area* FVTerm::getPrintArea() FVTerm::term_area* FVTerm::getPrintArea()
@ -2910,8 +2908,9 @@ inline void FVTerm::charsetChanges (char_data*& next_char)
uInt code = uInt(next_char->code); uInt code = uInt(next_char->code);
uInt ch_enc = charEncode(code); uInt ch_enc = charEncode(code);
if ( ch_enc != code ) if ( ch_enc == code )
{ return;
if ( ch_enc == 0 ) if ( ch_enc == 0 )
{ {
next_char->code = int(charEncode(code, fc::ASCII)); next_char->code = int(charEncode(code, fc::ASCII));
@ -2941,7 +2940,6 @@ inline void FVTerm::charsetChanges (char_data*& next_char)
} }
} }
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::appendCharacter (char_data*& next_char) inline void FVTerm::appendCharacter (char_data*& next_char)