- 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 Thomas Engel
Nishiishii Nishiishii
galvanizd 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 ...) + Supports relative due: dates (tomorrow, wednesday, 23rd, eom ...)
+ Bug: Fixed where Esc[0m sequences were being emitted for no good reason + Bug: Fixed where Esc[0m sequences were being emitted for no good reason
+ Bug: Fixed underlined table headers when color is turned off + Bug: Fixed underlined table headers when color is turned off
+ Bug: Adding a blank priority resulted in an assigned garbage value
------ reality ----------------------------------- ------ reality -----------------------------------

View File

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

View File

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

View File

@@ -403,6 +403,14 @@ void handleAdd (const TDB& tdb, T& task, Config& conf)
sprintf (entryTime, "%u", (unsigned int) time (NULL)); sprintf (entryTime, "%u", (unsigned int) time (NULL));
task.setAttribute ("entry", entryTime); 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") != "") if (task.getAttribute ("recur") != "")
decorateRecurringTask (task); 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>&); void join (std::string&, const std::string&, const std::vector<std::string>&);
std::string commify (const std::string&); std::string commify (const std::string&);
std::string lowerCase (const std::string&); std::string lowerCase (const std::string&);
std::string upperCase (const std::string&);
void delay (float); void delay (float);
int autoComplete (const std::string&, const std::vector<std::string>&, std::vector<std::string>&); int autoComplete (const std::string&, const std::vector<std::string>&, std::vector<std::string>&);
void formatTimeDeltaDays (std::string&, time_t); void formatTimeDeltaDays (std::string&, time_t);

View File

@@ -285,6 +285,17 @@ std::string lowerCase (const std::string& input)
return output; 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) const char* optionalBlankLine (Config& conf)
{ {