From bcdbd9019786c61aa474af246a8d36659ad4ff45 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 24 Apr 2019 16:34:57 -0700 Subject: [PATCH] Fix #587 (#588) --- packages/protocol/src/browser/modules/node-pty.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/protocol/src/browser/modules/node-pty.ts b/packages/protocol/src/browser/modules/node-pty.ts index 060de267..2f173705 100644 --- a/packages/protocol/src/browser/modules/node-pty.ts +++ b/packages/protocol/src/browser/modules/node-pty.ts @@ -9,6 +9,8 @@ interface ClientNodePtyProcessProxy extends NodePtyProcessProxy, ClientServerPro export class NodePtyProcess extends ClientProxy implements pty.IPty { private _pid = -1; private _process = ""; + private lastCols: number | undefined; + private lastRows: number | undefined; public constructor( private readonly moduleProxy: ClientNodePtyModuleProxy, @@ -37,6 +39,9 @@ export class NodePtyProcess extends ClientProxy imple } public resize(columns: number, rows: number): void { + this.lastCols = columns; + this.lastRows = rows; + this.catch(this.proxy.resize(columns, rows)); } @@ -51,7 +56,11 @@ export class NodePtyProcess extends ClientProxy imple protected handleDisconnect(): void { this._process += " (disconnected)"; this.emit("data", "\r\n\nLost connection...\r\n\n"); - this.initialize(this.moduleProxy.spawn(this.file, this.args, this.options)); + this.initialize(this.moduleProxy.spawn(this.file, this.args, { + ...this.options, + cols: this.lastCols || this.options.cols, + rows: this.lastRows || this.options.rows, + })); } }