From ee3668eb03bba671ab219c4abd07a1368a591137 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 24 Jul 2018 08:40:51 -0700 Subject: [PATCH] Report device status directly via emit Fixes #1579 --- src/InputHandler.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 3fda521f..bea5da2c 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -1712,15 +1712,13 @@ export class InputHandler extends Disposable implements IInputHandler { switch (params[0]) { case 5: // status report - this._terminal.send(C0.ESC + '[0n'); + this._terminal.emit('data', `${C0.ESC}[0n`); break; case 6: // cursor position - this._terminal.send(C0.ESC + '[' - + (this._terminal.buffer.y + 1) - + ';' - + (this._terminal.buffer.x + 1) - + 'R'); + const y = this._terminal.buffer.y + 1; + const x = this._terminal.buffer.x + 1; + this._terminal.emit('data', `${C0.ESC}[${y};${x}R`); break; } } else if (collect === '?') { @@ -1729,11 +1727,9 @@ export class InputHandler extends Disposable implements IInputHandler { switch (params[0]) { case 6: // cursor position - this._terminal.send(C0.ESC + '[?' - + (this._terminal.buffer.y + 1) - + ';' - + (this._terminal.buffer.x + 1) - + 'R'); + const y = this._terminal.buffer.y + 1; + const x = this._terminal.buffer.x + 1; + this._terminal.emit('data', `${C0.ESC}[?${y};${x}R`); break; case 15: // no printer