From b1b1d978668cd8a19aeafcd8b1782190922b7156 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 18 Jul 2015 13:08:37 -0400 Subject: [PATCH] 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. --- src/columns/ColID.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/columns/ColID.cpp b/src/columns/ColID.cpp index ddcda6512..03c976960 100644 --- a/src/columns/ColID.cpp +++ b/src/columns/ColID.cpp @@ -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;