Bug: ID column width calculations were wrong

- Fixed width calculations, which were wrong for tasks with ID numbers greater
  than 9999.
- Added simple (fast) heuristic for ID widths for ID number up to 100000.  64Kb
  RAM ought to be enough for anybody.
This commit is contained in:
Paul Beckingham 2015-07-18 13:08:37 -04:00
parent 9c9808e141
commit b1b1d97866

View file

@ -56,11 +56,12 @@ void ColumnID::measure (Task& task, unsigned int& minimum, unsigned int& maximum
{
int length;
if (task.id < 10) length = 1; // Fast
else if (task.id < 100) length = 2; // Fast
else if (task.id < 1000) length = 3; // Fast
else if (task.id < 10000) length = 4; // Fast
else length = (int) log10 ((double) task.id); // Slow
if (task.id < 10) length = 1; // Fast
else if (task.id < 100) length = 2; // Fast
else if (task.id < 1000) length = 3; // Fast
else if (task.id < 10000) length = 4; // Fast
else if (task.id < 100000) length = 5; // Fast
else length = 1 + (int) log10 ((double) task.id); // Slow
minimum = maximum = length;