mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
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:
parent
9c9808e141
commit
b1b1d97866
1 changed files with 6 additions and 5 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue