1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00

fix(token): more patches

This commit is contained in:
NBonaparte 2016-11-20 22:44:35 -08:00
parent d66c16674c
commit c658d22925

View file

@ -26,7 +26,7 @@ namespace drawtypes {
}
void label::replace_token(string token, string replacement) {
if (m_text.find(token) == string::npos)
if (m_text.find(token) == string::npos || m_token_iterator == m_token_bounds.end())
return;
m_tokenized = string_util::replace_all_bounded(m_tokenized, token, replacement,
@ -77,13 +77,14 @@ namespace drawtypes {
name = string_util::ltrim(string_util::rtrim(name, '>'), '<');
string text;
string line{text};
if (required)
text = conf.get<string>(section, name);
else
text = conf.get<string>(section, name, def);
string line{text};
while ((start = line.find('%')) != string::npos && (end = line.find('%', start + 1)) != string::npos) {
auto token = line.substr(start, end);