- Fixed bug whereby adding a new task with "task add asdfsd pri:" resulted in gibberish values in the priority field.

This commit is contained in:
Paul Beckingham 2008-07-05 16:49:41 -04:00
parent 188b9f36f2
commit e85d36cea0
7 changed files with 25 additions and 4 deletions

View file

@ -12,4 +12,5 @@ With thanks to:
Thomas Engel
Nishiishii
galvanizd
H. İbrahim Güngör

View file

@ -21,6 +21,7 @@ represents a feature release, and the Z represents a patch.
+ Supports relative due: dates (tomorrow, wednesday, 23rd, eom ...)
+ Bug: Fixed where Esc[0m sequences were being emitted for no good reason
+ Bug: Fixed underlined table headers when color is turned off
+ Bug: Adding a blank priority resulted in an assigned garbage value
------ reality -----------------------------------

View file

@ -58,6 +58,7 @@
"23rd", "eom"
<li>Fixed bug where Esc[0m sequences were being emitted for no good reason
<li>Fixed bug where table headers are underlined when color is turned off
<li>Fixed bug where adding a blank priority resulted in an assigned garbage value
</ul>
<p>

View file

@ -235,9 +235,7 @@ static bool validAttribute (
else if (name == "priority")
{
for (std::string::iterator i = value.begin (); i != value.end (); ++i)
*i = ::toupper (*i);
value = upperCase (value);
return validPriority (value);
}
@ -248,7 +246,7 @@ static bool validAttribute (
name == "base" ||
name == "range")
throw std::string ("\"") +
name +
name +
"\" is not an attribute you may modify directly.";
return true;

View file

@ -403,6 +403,14 @@ void handleAdd (const TDB& tdb, T& task, Config& conf)
sprintf (entryTime, "%u", (unsigned int) time (NULL));
task.setAttribute ("entry", entryTime);
std::map <std::string, std::string> atts;
task.getAttributes (atts);
foreach (i, atts)
{
if (i->second == "")
task.removeAttribute (i->first);
}
if (task.getAttribute ("recur") != "")
decorateRecurringTask (task);

View file

@ -102,6 +102,7 @@ void split (std::vector<std::string>&, const std::string&, const std::string&);
void join (std::string&, const std::string&, const std::vector<std::string>&);
std::string commify (const std::string&);
std::string lowerCase (const std::string&);
std::string upperCase (const std::string&);
void delay (float);
int autoComplete (const std::string&, const std::vector<std::string>&, std::vector<std::string>&);
void formatTimeDeltaDays (std::string&, time_t);

View file

@ -285,6 +285,17 @@ std::string lowerCase (const std::string& input)
return output;
}
////////////////////////////////////////////////////////////////////////////////
std::string upperCase (const std::string& input)
{
std::string output = input;
for (int i = 0; i < (int) input.length (); ++i)
if (::isupper (input[i]))
output[i] = ::toupper (input[i]);
return output;
}
////////////////////////////////////////////////////////////////////////////////
const char* optionalBlankLine (Config& conf)
{