Skip to content

Commit

Permalink
Adjust active terminal tab when active tab moves
Browse files Browse the repository at this point in the history
Fixes #106300
  • Loading branch information
alexr00 committed Sep 10, 2020
1 parent 3d6d718 commit bdfb5c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/vs/workbench/contrib/terminal/browser/terminalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ export class TerminalService implements ITerminalService {
private _removeTab(tab: ITerminalTab): void {
// Get the index of the tab and remove it from the list
const index = this._terminalTabs.indexOf(tab);
const wasActiveTab = tab === this.getActiveTab();
const activeTab = this.getActiveTab();
const activeTabIndex = activeTab ? this._terminalTabs.indexOf(activeTab) : -1;
const wasActiveTab = tab === activeTab;
if (index !== -1) {
this._terminalTabs.splice(index, 1);
}
Expand All @@ -247,6 +249,9 @@ export class TerminalService implements ITerminalService {
if (activeInstance) {
activeInstance.focus(true);
}
} else if (activeTabIndex >= this._terminalTabs.length) {
const newIndex = this._terminalTabs.length - 1;
this.setActiveTabByIndex(newIndex);
}

// Hide the panel if there are no more instances, provided that VS Code is not shutting
Expand Down

0 comments on commit bdfb5c8

Please sign in to comment.