mirror of
https://github.com/microsoft/vscode.git
synced 2026-10-01 07:35:00 +01:00
Merge pull request #285661 from murataslan1/fix/terminal-view-lifecycle
Fix: Replace terminal view lifecycle hack with Event.once
This commit is contained in:
@@ -337,13 +337,12 @@ export class TerminalViewPane extends ViewPane {
|
||||
// be focused. So wait for connection to finish, then focus.
|
||||
const previousActiveElement = this.element.ownerDocument.activeElement;
|
||||
if (previousActiveElement) {
|
||||
// TODO: Improve lifecycle management this event should be disposed after first fire
|
||||
this._register(this._terminalService.onDidChangeConnectionState(() => {
|
||||
const listener = this._register(Event.once(this._terminalService.onDidChangeConnectionState)(() => {
|
||||
// Only focus the terminal if the activeElement has not changed since focus() was called
|
||||
// TODO: Hack
|
||||
if (previousActiveElement && dom.isActiveElement(previousActiveElement)) {
|
||||
this._terminalGroupService.showPanel(true);
|
||||
}
|
||||
this._store.delete(listener);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user