From 63c32315d608e06e961e1f1c2a5617bac5940a73 Mon Sep 17 00:00:00 2001 From: Simon Parten Date: Tue, 24 Dec 2024 09:46:32 +0100 Subject: [PATCH] oops --- scautable/src/package.scala | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/scautable/src/package.scala b/scautable/src/package.scala index 2ea19fb..6629fa4 100644 --- a/scautable/src/package.scala +++ b/scautable/src/package.scala @@ -17,19 +17,13 @@ object scautable extends PlatformSpecific { def consoleFormat(table: Seq[Product]) = table match { case Seq() => "" case _ => - val indexLen = table.length.toString.length - val headers = table.head.productElementNames.toList - val sizes = for (row <- table) yield (for (cell <- row.productIterator.toSeq) yield if (cell == null) 0 else cell.toString.length) - val headSizes = for (i <- headers) yield headers.toString() - - val colSizes = for ((col, header) <- sizes.transpose.zip(headers)) yield Seq(header.toString().length(), col.max).max - + val indexLen = table.length.toString.length + val headers = table.head.productElementNames.toList + val sizes = for (row <- table) yield (for (cell <- row.productIterator.toSeq) yield if (cell == null) 0 else cell.toString.length) + val headSizes = for (i <- headers) yield headers.toString() + val colSizes = for ((col, header) <- sizes.transpose.zip(headers)) yield Seq(header.toString().length(), col.max).max val colSizesWithIndex = indexLen +: colSizes - - val rows = for ((row, i) <- table.zipWithIndex) yield formatRow(i +: row.productIterator.toSeq, colSizesWithIndex) - - println(colSizes) - println(colSizesWithIndex) + val rows = for ((row, i) <- table.zipWithIndex) yield formatRow(i +: row.productIterator.toSeq, colSizesWithIndex) formatHeader("" +: headers, colSizesWithIndex) ++ formatRows(rowSeparator(colSizesWithIndex), rows) }