toDump() fixed fills

This commit is contained in:
Sergey Chernov 2023-03-16 16:35:18 +01:00
parent eb25bcb94e
commit bd19570dec

View File

@ -134,14 +134,14 @@ fun ByteArray.toDumpLines(wide: Boolean = false): List<String> {
line.append(' ') line.append(' ')
} }
line!!.append((this[i].toUByte()).encodeToHex(2)) 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(' ') line.append(' ')
} }
if (line != null) { if (line != null) {
val l = size val l = size
var fill = lineSize - l % lineSize var fill = lineSize - l % lineSize
if( fill > lineSize/2 ) line.append(" ")
if (fill < lineSize) while (fill-- > 0) line.append(" ") if (fill < lineSize) while (fill-- > 0) line.append(" ")
line.append(" ")
val index = l - l % lineSize val index = l - l % lineSize
line.append(dumpChars(if (index < l) index else l - lineSize)) line.append(dumpChars(if (index < l) index else l - lineSize))
lines.add(line.toString()) lines.add(line.toString())