refactor(builder): Add failing test for ellipsis

Adds failing tests for the bug described in #1194
This commit is contained in:
patrick96
2018-04-28 23:18:02 +02:00
committed by NBonaparte
parent 028b1413ef
commit 4b83468eb9
5 changed files with 102 additions and 6 deletions

View File

@ -206,11 +206,7 @@ void builder::node(const label_t& label, bool add_space) {
return;
}
string text{label->get()};
if (label->m_maxlen > 0 && string_util::char_len(text) > label->m_maxlen) {
text = string_util::utf8_truncate(std::move(text), label->m_maxlen) + "...";
}
auto text = get_label_text(label);
// if ((label->m_overline.empty() && m_tags[syntaxtag::o] > 0) || (m_tags[syntaxtag::o] > 0 && label->m_margin > 0))
// overline_close();
@ -556,6 +552,16 @@ string builder::foreground_hex() {
return m_foreground;
}
string builder::get_label_text(const label_t& label) {
string text{label->get()};
if (label->m_maxlen > 0 && string_util::char_len(text) > label->m_maxlen) {
text = string_util::utf8_truncate(std::move(text), label->m_maxlen) + "...";
}
return text;
}
/**
* Insert directive to change value of given tag
*/