mirror of
https://github.com/Eugeny/tabby.git
synced 2024-11-26 03:27:23 +03:00
ref: Eugeny/tabby/pull#8416
This commit is contained in:
parent
2c0e50771f
commit
cea5cc73ff
@ -772,10 +772,7 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
|
||||
})
|
||||
|
||||
this.attachSessionHandler(this.session.closed$, () => {
|
||||
const behavior = this.profile.behaviorOnSessionEnd
|
||||
if (destroyOnSessionClose || behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()) {
|
||||
this.destroy()
|
||||
}
|
||||
this.onSessionClosed(destroyOnSessionClose)
|
||||
})
|
||||
|
||||
this.attachSessionHandler(this.session.destroyed$, () => {
|
||||
@ -788,6 +785,26 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called when session is closed.
|
||||
*/
|
||||
protected onSessionClosed (destroyOnSessionClose = false): void {
|
||||
if (destroyOnSessionClose || this.doesTabShouldBeDestroyedOnSessionClosed()) {
|
||||
this.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if tab should be destroyed on session closed.
|
||||
*/
|
||||
protected doesTabShouldBeDestroyedOnSessionClosed (): boolean {
|
||||
const behavior = this.profile.behaviorOnSessionEnd
|
||||
if (behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called when session is destroyed. Set the session to null
|
||||
*/
|
||||
|
@ -55,7 +55,7 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
||||
if (this.frontend) {
|
||||
if (this.profile.behaviorOnSessionEnd === 'reconnect') {
|
||||
this.reconnect()
|
||||
} else if (this.profile.behaviorOnSessionEnd === 'keep' || this.profile.behaviorOnSessionEnd === 'auto' && !this.isSessionExplicitlyTerminated()) {
|
||||
} else if (this.profile.behaviorOnSessionEnd === 'keep' || !this.doesTabShouldBeDestroyedOnSessionClosed()) {
|
||||
this.offerReconnection()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user