Skip to content

Commit ce36ade

Browse files
committed
fix up corner case
1 parent 946999b commit ce36ade

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fieldeditors.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,16 @@ namespace microcode {
186186
let ret = ""
187187
for (let row = 0; row < 5; row++) {
188188
for (let col = 0; col < 5; col++) {
189-
ret += img.getPixel(col, row) ? `1 ` : `. `
189+
ret += img.getPixel(col, row) ? `1` : `.`
190+
if (col < 4) ret += " "
190191
}
191192
ret += `\n`
192193
}
193194
return ret
194195
}
195196
fromString(txt: string): Bitmap {
196197
let ret = bitmaps.create(5, 5)
197-
let seq = txt.split(" \n")
198+
let seq = txt.split("\n").join(" ").split(" ")
198199
seq.forEach((s, i) => {
199200
ret.setPixel(i % 5, Math.idiv(i, 5), s == "1" ? 1 : 0)
200201
})

0 commit comments

Comments
 (0)