- Fixed Table::calculateColumnWidths bug.

This commit is contained in:
Paul Beckingham 2008-05-24 23:08:36 -04:00
parent ab0a57ec89
commit 45a25ca47b
7 changed files with 366 additions and 59 deletions

View file

@ -476,8 +476,16 @@ void Table::calculateColumnWidths ()
mCalculatedWidth = ideal;
return;
}
// else
else
{
// std::cout << "# insufficient room, considering only flexible columns." << std::endl;
// The fallback position is to assume no width was specificed, and just
// calculate widths accordingly.
mTableWidth = 0;
calculateColumnWidths ();
return;
}
}
// Try again, treating minimum columns as flexible.

View file

@ -56,32 +56,32 @@ void usage (Config& conf)
table.addCell (row, 1, "task");
row = table.addRow ();
table.addCell (row, 1, "task add [tags] [attributes] description...");
table.addCell (row, 1, "task add [tags] [attrs] desc...");
table.addCell (row, 2, "Adds a new task");
row = table.addRow ();
table.addCell (row, 1, "task list [tags] [attributes] description...");
table.addCell (row, 1, "task list [tags] [attrs] desc...");
table.addCell (row, 2, "Lists all tasks matching the specified criteria");
row = table.addRow ();
table.addCell (row, 1, "task long [tags] [attributes] description...");
table.addCell (row, 1, "task long [tags] [attrs] desc...");
table.addCell (row, 2, "Lists all task, all data, matching the specified criteria");
row = table.addRow ();
table.addCell (row, 1, "task ls [tags] [attributes] description...");
table.addCell (row, 1, "task ls [tags] [attrs] desc...");
table.addCell (row, 2, "Minimal listing of all tasks matching the specified criteria");
row = table.addRow ();
table.addCell (row, 1, "task completed [tags] [attributes] description...");
table.addCell (row, 1, "task completed [tags] [attrs] desc...");
table.addCell (row, 2, "Chronological listing of all completed tasks matching the specified criteria");
row = table.addRow ();
table.addCell (row, 1, "task ID [tags] [attributes] [description...]");
table.addCell (row, 1, "task ID [tags] [attrs] [desc...]");
table.addCell (row, 2, "Modifies the existing task with provided arguments");
row = table.addRow ();
table.addCell (row, 1, "task ID /from/to/");
table.addCell (row, 2, "Perform the substitution on the description, for fixing mistakes");
table.addCell (row, 2, "Perform the substitution on the desc, for fixing mistakes");
row = table.addRow ();
table.addCell (row, 1, "task delete ID");

View file

@ -183,8 +183,16 @@ void extractLine (std::string& text, std::string& line, int length)
// If no space was found, hyphenate.
else
{
line = text.substr (0, length - 1) + "-";
text = text.substr (length - 1, std::string::npos);
if (length > 1)
{
line = text.substr (0, length - 1) + "-";
text = text.substr (length - 1, std::string::npos);
}
else
{
line = text.substr (0, 1);
text = text.substr (length, std::string::npos);
}
}
}