@@ -151,15 +151,6 @@ export class TerminalEditorInput extends EditorInput implements IEditorCloseHand
151
151
const instanceOnDidFocusListener = instance . onDidFocus ( ( ) => this . _terminalEditorFocusContextKey . set ( true ) ) ;
152
152
const instanceOnDidBlurListener = instance . onDidBlur ( ( ) => this . _terminalEditorFocusContextKey . reset ( ) ) ;
153
153
154
- this . _register ( toDisposable ( ( ) => {
155
- if ( ! this . _isDetached && ! this . _isShuttingDown ) {
156
- // Will be ignored if triggered by onExit or onDisposed terminal events
157
- // as disposed was already called
158
- instance . dispose ( TerminalExitReason . User ) ;
159
- }
160
- dispose ( [ instanceOnDidFocusListener , instanceOnDidBlurListener ] ) ;
161
- } ) ) ;
162
-
163
154
const disposeListeners = [
164
155
instance . onExit ( ( e ) => {
165
156
if ( ! instance . waitOnExit ) {
@@ -174,9 +165,19 @@ export class TerminalEditorInput extends EditorInput implements IEditorCloseHand
174
165
instance . statusList . onDidChangePrimaryStatus ( ( ) => this . _onDidChangeLabel . fire ( ) )
175
166
] ;
176
167
168
+ this . _register ( toDisposable ( ( ) => {
169
+ if ( ! this . _isDetached && ! this . _isShuttingDown ) {
170
+ // Will be ignored if triggered by onExit or onDisposed terminal events
171
+ // as disposed was already called
172
+ instance . dispose ( TerminalExitReason . User ) ;
173
+ }
174
+ dispose ( disposeListeners ) ;
175
+ dispose ( [ instanceOnDidFocusListener , instanceOnDidBlurListener ] ) ;
176
+ } ) ) ;
177
+
177
178
// Don't dispose editor when instance is torn down on shutdown to avoid extra work and so
178
179
// the editor/tabs don't disappear
179
- this . _lifecycleService . onWillShutdown ( ( e : WillShutdownEvent ) => {
180
+ this . _register ( this . _lifecycleService . onWillShutdown ( ( e : WillShutdownEvent ) => {
180
181
this . _isShuttingDown = true ;
181
182
dispose ( disposeListeners ) ;
182
183
@@ -187,7 +188,7 @@ export class TerminalEditorInput extends EditorInput implements IEditorCloseHand
187
188
} else {
188
189
instance . dispose ( TerminalExitReason . Shutdown ) ;
189
190
}
190
- } ) ;
191
+ } ) ) ;
191
192
}
192
193
193
194
override getName ( ) {
0 commit comments