From bd19570decdb672d88d881d1627a37e337ae473e Mon Sep 17 00:00:00 2001 From: sergeych Date: Thu, 16 Mar 2023 16:35:18 +0100 Subject: [PATCH] toDump() fixed fills --- src/commonMain/kotlin/net.sergeych.bintools/simple_codecs.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commonMain/kotlin/net.sergeych.bintools/simple_codecs.kt b/src/commonMain/kotlin/net.sergeych.bintools/simple_codecs.kt index ce01468..b4cda61 100644 --- a/src/commonMain/kotlin/net.sergeych.bintools/simple_codecs.kt +++ b/src/commonMain/kotlin/net.sergeych.bintools/simple_codecs.kt @@ -134,14 +134,14 @@ fun ByteArray.toDumpLines(wide: Boolean = false): List { line.append(' ') } line!!.append((this[i].toUByte()).encodeToHex(2)) - if( i == lineSize/2) line.append(" \u250A") + if( i % lineSize == lineSize/2 - 1) line.append(" \u250A") line.append(' ') } if (line != null) { val l = size var fill = lineSize - l % lineSize + if( fill > lineSize/2 ) line.append(" ") if (fill < lineSize) while (fill-- > 0) line.append(" ") - line.append(" ") val index = l - l % lineSize line.append(dumpChars(if (index < l) index else l - lineSize)) lines.add(line.toString())