fix: Avoid unnecessary color change

Ref #181
This commit is contained in:
Michael Carlberg 2016-11-22 22:45:12 +01:00
parent cd005a9ce6
commit c6e861083b
3 changed files with 15 additions and 5 deletions

View File

@ -73,6 +73,8 @@ class renderer {
uint32_t m_background{0};
uint32_t m_foreground{0};
gc m_background_gc{gc::NONE};
gc m_foreground_gc{gc::NONE};
edge m_reserve_at{edge::NONE};
uint16_t m_reserve;

View File

@ -550,9 +550,15 @@ void controller::on_update() {
block_contents += padding_right;
}
// Strip unnecessary reset tags
block_contents = string_util::replace_all(block_contents, "T-}%{T", "T");
block_contents = string_util::replace_all(block_contents, "B-}%{B#", "B#");
block_contents = string_util::replace_all(block_contents, "F-}%{F#", "F#");
block_contents = string_util::replace_all(block_contents, "T-}%{T", "T");
block_contents = string_util::replace_all(block_contents, "U-}%{U#", "U#");
block_contents = string_util::replace_all(block_contents, "Uu-}%{Uu#", "Uu#");
block_contents = string_util::replace_all(block_contents, "Uo-}%{Uo#", "Uo#");
// Join consecutive tags
contents += string_util::replace_all(block_contents, "}%{", " ");
}

View File

@ -64,9 +64,11 @@ void parser::codeblock(string data) {
case 'U':
if (g_signals::parser::color_change) {
if (value[0] == 'u' && data.find(" Uu") == string::npos) {
if (value[0] == 'u') {
if (data.find(" Uu") == string::npos)
g_signals::parser::color_change(gc::UL, parse_color(value.substr(1), m_bar.underline.color));
} else if (value[0] == 'o' && data.find(" Uo") == string::npos) {
} else if (value[0] == 'o') {
if (data.find(" Uo") == string::npos)
g_signals::parser::color_change(gc::OL, parse_color(value.substr(1), m_bar.overline.color));
} else if (data.find(" U") == string::npos) {
g_signals::parser::color_change(gc::UL, parse_color(value, m_bar.underline.color));