Skip to content

Commit 932d6f9

Browse files
committed
ensure that the entire terminal is being rendered to
1 parent 301a6a8 commit 932d6f9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ function render () {
6767
var data = ctx.getImageData(0, 0, w, h).data;
6868

6969
for (var i = 0, l = data.length; i < l; i += 4) {
70+
if ((i/4|0) % w === 0) {
71+
// end of the row
72+
cursor.bg.reset();
73+
cursor.write('\n');
74+
}
75+
7076
var r = data[i];
7177
var g = data[i+1];
7278
var b = data[i+2];
@@ -79,11 +85,5 @@ function render () {
7985
}
8086

8187
cursor.write(pixel);
82-
83-
if ((i/4|0) % w === (w-1)) {
84-
// end of the row
85-
cursor.bg.reset();
86-
cursor.write('\n');
87-
}
8888
}
8989
}

0 commit comments

Comments
 (0)