remove $? formatting from song format while converting to string

this fixes wrong results while searching for phrase
that contains dollar or one of dollar formatting.
This commit is contained in:
Andrzej Rybczak
2011-02-23 20:16:23 +01:00
parent f3e1ba1c26
commit e323025a82
6 changed files with 20 additions and 4 deletions

View File

@@ -123,6 +123,19 @@ namespace
return 0;
}
}
std::string RemoveDollarFormatting(const std::string &s)
{
std::string result;
for (size_t i = 0; i < s.size(); ++i)
{
if (s[i] != '$')
result += s[i];
else
++i;
}
return result;
}
}
void CreateConfigDir()
@@ -335,6 +348,7 @@ void NcmpcppConfig::SetDefaults()
empty_tag = "<empty>";
song_list_columns_format = "(7f)[green]{l} (25)[cyan]{a} (40)[]{t|f} (30)[red]{b}";
song_list_format = "{{%a - }{%t}|{$8%f$9}$R{$3(%l)$9}}";
song_list_format_dollar_free = RemoveDollarFormatting(song_list_format);
song_status_format = "{{{%a{ \"%b\"{ (%y)}} - }{%t}}|{%f}}";
song_status_format_no_colors = song_status_format;
song_window_title_format = "{{%a - }{%t}|{%f}}";
@@ -698,6 +712,7 @@ void NcmpcppConfig::Read()
song_list_format = '{';
song_list_format += v;
song_list_format += '}';
song_list_format_dollar_free = RemoveDollarFormatting(song_list_format);
}
}
else if (cl.find("song_columns_list_format") != std::string::npos)