This commit is contained in:
Kyle Carberry 2019-04-24 16:34:57 -07:00 committed by Asher
parent 0de7247868
commit bcdbd90197
1 changed files with 10 additions and 1 deletions

View File

@ -9,6 +9,8 @@ interface ClientNodePtyProcessProxy extends NodePtyProcessProxy, ClientServerPro
export class NodePtyProcess extends ClientProxy<ClientNodePtyProcessProxy> implements pty.IPty { export class NodePtyProcess extends ClientProxy<ClientNodePtyProcessProxy> implements pty.IPty {
private _pid = -1; private _pid = -1;
private _process = ""; private _process = "";
private lastCols: number | undefined;
private lastRows: number | undefined;
public constructor( public constructor(
private readonly moduleProxy: ClientNodePtyModuleProxy, private readonly moduleProxy: ClientNodePtyModuleProxy,
@ -37,6 +39,9 @@ export class NodePtyProcess extends ClientProxy<ClientNodePtyProcessProxy> imple
} }
public resize(columns: number, rows: number): void { public resize(columns: number, rows: number): void {
this.lastCols = columns;
this.lastRows = rows;
this.catch(this.proxy.resize(columns, rows)); this.catch(this.proxy.resize(columns, rows));
} }
@ -51,7 +56,11 @@ export class NodePtyProcess extends ClientProxy<ClientNodePtyProcessProxy> imple
protected handleDisconnect(): void { protected handleDisconnect(): void {
this._process += " (disconnected)"; this._process += " (disconnected)";
this.emit("data", "\r\n\nLost connection...\r\n\n"); 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,
}));
} }
} }