Skip to content

Commit

Permalink
Merge pull request #128650 from microsoft/tyriar/r158_128255
Browse files Browse the repository at this point in the history
Unset active terminal group when last is removed
  • Loading branch information
Tyriar authored Jul 14, 2021
2 parents d9e4111 + 35b634d commit 268e9da
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/terminalGroupService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,22 @@ export class TerminalGroupService extends Disposable implements ITerminalGroupSe
* group has been removed.
*/
setActiveGroupByIndex(index: number, force?: boolean) {
// Unset active group when the last group is removed
if (index === -1 && this.groups.length === 0) {
if (this.activeGroupIndex !== -1) {
this.activeGroupIndex = -1;
this._onDidChangeActiveGroup.fire(this.activeGroup);
this._onDidChangeActiveInstance.fire(this.activeInstance);
}
return;
}

// Ensure index is valid
if (index < 0 || index >= this.groups.length) {
return;
}

// Fire group/instance change if needed
const oldActiveGroup = this.activeGroup;
this.activeGroupIndex = index;
if (force || oldActiveGroup !== this.activeGroup) {
Expand Down

0 comments on commit 268e9da

Please sign in to comment.