提交 33e339e9 编写于 作者: B Ben Stein

Added deregistration for title change check on the terminal message event.

上级 d7757bd8
...@@ -59,6 +59,7 @@ export class TerminalInstance implements ITerminalInstance { ...@@ -59,6 +59,7 @@ export class TerminalInstance implements ITerminalInstance {
private _isDisposed: boolean; private _isDisposed: boolean;
private _onDisposed: Emitter<ITerminalInstance>; private _onDisposed: Emitter<ITerminalInstance>;
private _onDataForApi: Emitter<{ instance: ITerminalInstance, data: string }>; private _onDataForApi: Emitter<{ instance: ITerminalInstance, data: string }>;
private _onMessageTitleCheck: (message: any) => void;
private _onProcessIdReady: Emitter<TerminalInstance>; private _onProcessIdReady: Emitter<TerminalInstance>;
private _onTitleChanged: Emitter<string>; private _onTitleChanged: Emitter<string>;
private _process: cp.ChildProcess; private _process: cp.ChildProcess;
...@@ -479,13 +480,13 @@ export class TerminalInstance implements ITerminalInstance { ...@@ -479,13 +480,13 @@ export class TerminalInstance implements ITerminalInstance {
}); });
if (!shell.name) { if (!shell.name) {
// Only listen for process title changes when a name is not provided // Only listen for process title changes when a name is not provided
this._process.on('message', this._onPtyProcessMessageTitleChanged); this._onMessageTitleCheck = (message) => {
// this._process.on('message', (message) => { if (message.type === 'title') {
// if (message.type === 'title') { this._title = message.content ? message.content : '';
// this._title = message.content ? message.content : ''; this._onTitleChanged.fire(this._title);
// this._onTitleChanged.fire(this._title); }
// } };
// }); this._process.on('message', this._onMessageTitleCheck);
} }
this._process.on('message', (message) => { this._process.on('message', (message) => {
if (message.type === 'pid') { if (message.type === 'pid') {
...@@ -562,13 +563,6 @@ export class TerminalInstance implements ITerminalInstance { ...@@ -562,13 +563,6 @@ export class TerminalInstance implements ITerminalInstance {
} }
} }
private _onPtyProcessMessageTitleChanged(message: any): void {
if (message.type === 'title') {
this._title = message.content ? message.content : '';
this._onTitleChanged.fire(this._title);
}
}
private _attachPressAnyKeyToCloseListener() { private _attachPressAnyKeyToCloseListener() {
this._processDisposables.push(dom.addDisposableListener(this._xterm.textarea, 'keypress', (event: KeyboardEvent) => { this._processDisposables.push(dom.addDisposableListener(this._xterm.textarea, 'keypress', (event: KeyboardEvent) => {
this.dispose(); this.dispose();
...@@ -779,7 +773,7 @@ export class TerminalInstance implements ITerminalInstance { ...@@ -779,7 +773,7 @@ export class TerminalInstance implements ITerminalInstance {
// if the title is set via API, unregister the handler that automatically updates the terminal name // if the title is set via API, unregister the handler that automatically updates the terminal name
if (this._process) { if (this._process) {
this._process.removeListener('message', this._onPtyProcessMessageTitleChanged); this._process.removeListener('message', this._onMessageTitleCheck);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册