mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
ColPriority
- Made the acceptance of lower-case priorities explicitly either lower or upper case, but converted to upper case. This eliminates the dependency on text.cpp upperCase(), which is not UTF8-safe.
This commit is contained in:
parent
952d743218
commit
693fe9b8fd
1 changed files with 10 additions and 9 deletions
|
@ -53,17 +53,14 @@ ColumnPriority::~ColumnPriority ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Allow lower case, but implicitly convert.
|
||||||
bool ColumnPriority::validate (std::string& value)
|
bool ColumnPriority::validate (std::string& value)
|
||||||
{
|
{
|
||||||
value = upperCase (value);
|
if (value == "h") { value = "H"; return true; }
|
||||||
|
else if (value == "m") { value = "M"; return true; }
|
||||||
|
else if (value == "l") { value = "L"; return true; }
|
||||||
|
|
||||||
if (value == "H" ||
|
return value == "H" || value == "M" || value == "L" || value == "";
|
||||||
value == "M" ||
|
|
||||||
value == "L" ||
|
|
||||||
value == "")
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -120,7 +117,11 @@ void ColumnPriority::render (
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string ColumnPriority::modify (std::string& value)
|
std::string ColumnPriority::modify (std::string& value)
|
||||||
{
|
{
|
||||||
return upperCase (value);
|
if (value == "h") value = "H";
|
||||||
|
else if (value == "m") value = "M";
|
||||||
|
else if (value == "l") value = "L";
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue