Alignment of file numbers modified. Closed #12

parent 352f22e4
......@@ -456,6 +456,18 @@ void runVitisFile(string vitisFile,
}
private size_t calcNumberOfDigits(long x) {
long p = 10;
for (int i = 1; i < 19; ++i) {
if (x < p) {
return i;
}
p *= 10;
}
return 19;
}
private void printLinkNameLine(string linkName,
ssize_t currNumber,
ssize_t maxNumber,
......@@ -466,12 +478,11 @@ private void printLinkNameLine(string linkName,
noNumbers = true;
linkName = `"`~linkName~`"`;
}
auto numberOfDigits = to!string(maxNumber).length;
auto numberOfCurrentDigits = to!string(currNumber).length;
auto numberOfDigits = calcNumberOfDigits(maxNumber);
if (!noNumbers) {
auto numberOfSpaces = numberOfDigits - numberOfCurrentDigits;
for (size_t j; j < numberOfSpaces; j++) write(" ");
"simple".tprint("[", currNumber, "] ");
auto printableNumber = "[" ~ currNumber.to!string ~ "]";
auto numberField = rightJustify(printableNumber, numberOfDigits+2);
"simple".tprint(numberField, " ");
}
if (numberOfRepeating) {
"simple".tprint(numberOfRepeating, "/");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment