Fixes bug #7313: Unit list doesn't show the data in the correct column for
units without name. Applied patch #2496.
This commit is contained in:
parent
15e1b9ce01
commit
ec69aa4ebf
3 changed files with 5 additions and 5 deletions
|
@ -770,7 +770,7 @@ const config* config::find_child(const std::string& key,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
std::vector<std::string> config::split(const std::string& val, char c)
|
||||
std::vector<std::string> config::split(const std::string& val, char c, bool remove_empty)
|
||||
{
|
||||
std::vector<std::string> res;
|
||||
|
||||
|
@ -781,7 +781,7 @@ std::vector<std::string> config::split(const std::string& val, char c)
|
|||
if(*i2 == c) {
|
||||
std::string new_val(i1,i2);
|
||||
strip(new_val);
|
||||
if(!new_val.empty())
|
||||
if(!remove_empty || !new_val.empty())
|
||||
res.push_back(new_val);
|
||||
++i2;
|
||||
while(i2 != val.end() && *i2 == ' ')
|
||||
|
@ -795,7 +795,7 @@ std::vector<std::string> config::split(const std::string& val, char c)
|
|||
|
||||
std::string new_val(i1,i2);
|
||||
strip(new_val);
|
||||
if(!new_val.empty())
|
||||
if(!remove_empty || !new_val.empty())
|
||||
res.push_back(new_val);
|
||||
|
||||
return res;
|
||||
|
|
|
@ -122,7 +122,7 @@ struct config
|
|||
void clear_children(const std::string& key);
|
||||
config* remove_child(const std::string& key, size_t index);
|
||||
|
||||
static std::vector<std::string> split(const std::string& val, char c=',');
|
||||
static std::vector<std::string> split(const std::string& val, char c=',', bool remove_empty=true);
|
||||
static std::string& strip(std::string& str);
|
||||
static bool has_value(const std::string& values, const std::string& val);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ menu::menu(display& disp, const std::vector<std::string>& items,
|
|||
{
|
||||
for(std::vector<std::string>::const_iterator item = items.begin();
|
||||
item != items.end(); ++item) {
|
||||
items_.push_back(config::split(*item));
|
||||
items_.push_back(config::split(*item,',',false));
|
||||
|
||||
//make sure there is always at least one item
|
||||
if(items_.back().empty())
|
||||
|
|
Loading…
Add table
Reference in a new issue