Skip to content

Commit 2124be3

Browse files
committed
don't cache the cursor instance
1 parent a84e3bc commit 2124be3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ function term (opts) {
3636
// cached "context"
3737
canvas.renderCtx = canvas.getContext('2d');
3838

39-
// create `ansi()` cursor
40-
canvas.cursor = ansi(stream);
41-
4239
return canvas;
4340
}
4441

@@ -49,20 +46,21 @@ function term (opts) {
4946
*/
5047

5148
function render () {
49+
var cursor = ansi(this.stream);
50+
cursor.write('\n');
5251

5352
// erase everything on the screen
54-
this.cursor.eraseData(2);
53+
cursor.eraseData(2);
5554

5655
// go to the top left origin (1-indexed, not 0...)
57-
this.cursor.goto(1, 1);
56+
cursor.goto(1, 1);
5857

5958
// render the current <canvas> contents to the TTY
6059
var ctx = this.renderCtx;
6160
var w = this.width;
6261
var h = this.height;
6362
var alphaThreshold = 0;
6463
var pixel = this.pixel;
65-
var cursor = this.cursor;
6664

6765
var data = ctx.getImageData(0, 0, w, h).data;
6866

0 commit comments

Comments
 (0)