File tree 1 file changed +6
-1
lines changed
src/vs/workbench/contrib/terminal/browser
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -232,7 +232,9 @@ export class TerminalService implements ITerminalService {
232
232
private _removeTab ( tab : ITerminalTab ) : void {
233
233
// Get the index of the tab and remove it from the list
234
234
const index = this . _terminalTabs . indexOf ( tab ) ;
235
- const wasActiveTab = tab === this . getActiveTab ( ) ;
235
+ const activeTab = this . getActiveTab ( ) ;
236
+ const activeTabIndex = activeTab ? this . _terminalTabs . indexOf ( activeTab ) : - 1 ;
237
+ const wasActiveTab = tab === activeTab ;
236
238
if ( index !== - 1 ) {
237
239
this . _terminalTabs . splice ( index , 1 ) ;
238
240
}
@@ -247,6 +249,9 @@ export class TerminalService implements ITerminalService {
247
249
if ( activeInstance ) {
248
250
activeInstance . focus ( true ) ;
249
251
}
252
+ } else if ( activeTabIndex >= this . _terminalTabs . length ) {
253
+ const newIndex = this . _terminalTabs . length - 1 ;
254
+ this . setActiveTabByIndex ( newIndex ) ;
250
255
}
251
256
252
257
// Hide the panel if there are no more instances, provided that VS Code is not shutting
You can’t perform that action at this time.
0 commit comments