File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed
src/vs/workbench/contrib/terminal/browser Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ export interface ITerminalGroup {
133
133
activeInstance : ITerminalInstance | undefined ;
134
134
terminalInstances : ITerminalInstance [ ] ;
135
135
title : string ;
136
+ readonly hadFocusOnExit : boolean ;
136
137
137
138
readonly onDidDisposeInstance : Event < ITerminalInstance > ;
138
139
readonly onDisposed : Event < ITerminalGroup > ;
Original file line number Diff line number Diff line change @@ -251,6 +251,9 @@ export class TerminalGroup extends Disposable implements ITerminalGroup {
251
251
252
252
get terminalInstances ( ) : ITerminalInstance [ ] { return this . _terminalInstances ; }
253
253
254
+ private _hadFocusOnExit : boolean = false ;
255
+ get hadFocusOnExit ( ) : boolean { return this . _hadFocusOnExit ; }
256
+
254
257
private _initialRelativeSizes : number [ ] | undefined ;
255
258
private _visible : boolean = false ;
256
259
@@ -395,6 +398,7 @@ export class TerminalGroup extends Disposable implements ITerminalGroup {
395
398
396
399
// Fire events and dispose group if it was the last instance
397
400
if ( this . _terminalInstances . length === 0 ) {
401
+ this . _hadFocusOnExit = instance . hadFocusOnExit ;
398
402
this . _onDisposed . fire ( this ) ;
399
403
this . dispose ( ) ;
400
404
} else {
Original file line number Diff line number Diff line change @@ -218,7 +218,9 @@ export class TerminalGroupService extends Disposable implements ITerminalGroupSe
218
218
if ( this . groups . length > 0 && ! this . _isQuickInputOpened ) {
219
219
const newIndex = index < this . groups . length ? index : this . groups . length - 1 ;
220
220
this . setActiveGroupByIndex ( newIndex , true ) ;
221
- this . activeInstance ?. focus ( true ) ;
221
+ if ( group . hadFocusOnExit ) {
222
+ this . activeInstance ?. focus ( true ) ;
223
+ }
222
224
}
223
225
} else {
224
226
// Adjust the active group if the removed group was above the active group
You can’t perform that action at this time.
0 commit comments