Improvement in class FOptiAttr

This commit is contained in:
Markus Gans 2018-04-08 16:32:02 +02:00
parent 9978c7e341
commit 356879bc1a
5 changed files with 998 additions and 37 deletions

View File

@ -1,3 +1,7 @@
2017-04-08 Markus Gans <guru.mail@muenster.de>
* Improved Linux terminal quirks
* Improvement in class FOptiAttr
2017-04-02 Markus Gans <guru.mail@muenster.de> 2017-04-02 Markus Gans <guru.mail@muenster.de>
* Improved cygwin terminal quirks * Improved cygwin terminal quirks
* Optimized character set switching in FOptiAttr * Optimized character set switching in FOptiAttr

View File

@ -290,7 +290,6 @@ class FOptiAttr
bool switchOn(); bool switchOn();
bool switchOff(); bool switchOff();
bool append_sequence (char[]); bool append_sequence (char[]);
bool replace_sequence (char[]);
// Data Members // Data Members
capability F_enter_bold_mode; capability F_enter_bold_mode;

View File

@ -566,7 +566,8 @@ char* FOptiAttr::changeAttribute (char_data*& term, char_data*& next)
{ {
deactivateAttributes (term, next); deactivateAttributes (term, next);
} }
else if ( F_set_attributes.cap && ! term->attr.bit.pc_charset ) else if ( F_set_attributes.cap
&& ( ! term->attr.bit.pc_charset || alt_equal_pc_charset) )
{ {
changeAttributeSGR (term, next); changeAttributeSGR (term, next);
} }
@ -985,7 +986,7 @@ inline bool FOptiAttr::unsetTermAttributes (char_data*& term)
reset(term); reset(term);
if ( replace_sequence(F_exit_attribute_mode.cap) ) if ( append_sequence(F_exit_attribute_mode.cap) )
return true; return true;
else else
return false; return false;
@ -1340,6 +1341,9 @@ inline void FOptiAttr::deactivateAttributes ( char_data*& term
{ {
if ( F_exit_attribute_mode.cap ) if ( F_exit_attribute_mode.cap )
{ {
if ( off.attr.bit.alt_charset ) // Required for rxvt terminals
unsetTermAltCharset(term);
unsetTermAttributes(term); unsetTermAttributes(term);
if ( off.attr.bit.pc_charset ) if ( off.attr.bit.pc_charset )
@ -1373,8 +1377,8 @@ inline void FOptiAttr::changeAttributeSGR ( char_data*& term
if ( alt_equal_pc_charset && next->attr.bit.alt_charset ) if ( alt_equal_pc_charset && next->attr.bit.alt_charset )
{ {
term->attr.bit.pc_charset = true; term->attr.bit.pc_charset = next->attr.bit.pc_charset;
off.attr.bit.pc_charset = false; off.attr.bit.pc_charset = false;
pc_charset_usable = false; pc_charset_usable = false;
} }
@ -1569,10 +1573,12 @@ bool FOptiAttr::caused_reset_attributes (char cap[], uChar test)
if ( (test & test_adm3_reset) && std::strncmp (cap, ESC "G0", 3) == 0 ) if ( (test & test_adm3_reset) && std::strncmp (cap, ESC "G0", 3) == 0 )
return true; return true;
if ( (test & same_like_ue) && ue && std::strcmp (cap, ue) == 0 ) if ( (test & same_like_ue) && ue && std::strcmp (cap, ue) == 0
&& std::strncmp (cap, CSI "24m", 5) != 0)
return true; return true;
if ( (test & same_like_se) && se && std::strcmp (cap, se) == 0 ) if ( (test & same_like_se) && se && std::strcmp (cap, se) == 0
&& std::strncmp (cap, CSI "27m", 5) != 0 )
return true; return true;
if ( (test & same_like_me) && me && std::strcmp (cap, me) == 0 ) if ( (test & same_like_me) && me && std::strcmp (cap, me) == 0 )
@ -1668,15 +1674,3 @@ inline bool FOptiAttr::append_sequence (char seq[])
else else
return false; return false;
} }
//----------------------------------------------------------------------
inline bool FOptiAttr::replace_sequence (char seq[])
{
if ( seq )
{
std::strncpy (attr_ptr, seq, sizeof(attr_buf) - 1);
return true;
}
else
return false;
}

View File

@ -3663,6 +3663,9 @@ void FTerm::init_termcaps_linux_quirks()
TCAP(fc::t_orig_pair) = \ TCAP(fc::t_orig_pair) = \
C_STR(CSI "39;49;25m"); C_STR(CSI "39;49;25m");
TCAP(fc::t_exit_reverse_mode) = \
C_STR(CSI "27m");
// 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;

File diff suppressed because it is too large Load Diff