mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-08 13:30:02 +00: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$, () => {
|
this.attachSessionHandler(this.session.closed$, () => {
|
||||||
const behavior = this.profile.behaviorOnSessionEnd
|
this.onSessionClosed(destroyOnSessionClose)
|
||||||
if (destroyOnSessionClose || behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()) {
|
|
||||||
this.destroy()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this.attachSessionHandler(this.session.destroyed$, () => {
|
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
|
* 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.frontend) {
|
||||||
if (this.profile.behaviorOnSessionEnd === 'reconnect') {
|
if (this.profile.behaviorOnSessionEnd === 'reconnect') {
|
||||||
this.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()
|
this.offerReconnection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user