mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +00:00
refactoring Eugeny/tabby#8589 (shouldTabBeDestroyedOnSessionClose)
This commit is contained in:
@@ -789,7 +789,7 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
|
||||
* Method called when session is closed.
|
||||
*/
|
||||
protected onSessionClosed (destroyOnSessionClose = false): void {
|
||||
if (destroyOnSessionClose || this.doesTabShouldBeDestroyedOnSessionClosed()) {
|
||||
if (destroyOnSessionClose || this.shouldTabBeDestroyedOnSessionClose()) {
|
||||
this.destroy()
|
||||
}
|
||||
}
|
||||
@@ -797,12 +797,9 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
|
||||
/**
|
||||
* Return true if tab should be destroyed on session closed.
|
||||
*/
|
||||
protected doesTabShouldBeDestroyedOnSessionClosed (): boolean {
|
||||
protected shouldTabBeDestroyedOnSessionClose (): boolean {
|
||||
const behavior = this.profile.behaviorOnSessionEnd
|
||||
if (behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -68,7 +68,7 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
||||
if (this.frontend) {
|
||||
if (this.profile.behaviorOnSessionEnd === 'reconnect' && !this.isDisconnectedByHand) {
|
||||
this.reconnect()
|
||||
} else if (this.profile.behaviorOnSessionEnd === 'keep' || !this.doesTabShouldBeDestroyedOnSessionClosed()) {
|
||||
} else if (this.profile.behaviorOnSessionEnd === 'keep' || !this.shouldTabBeDestroyedOnSessionClose()) {
|
||||
this.offerReconnection()
|
||||
}
|
||||
}
|
||||
@@ -93,11 +93,11 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
||||
/**
|
||||
* Return true if tab should be destroyed on session closed.
|
||||
*/
|
||||
protected doesTabShouldBeDestroyedOnSessionClosed (): boolean {
|
||||
protected shouldTabBeDestroyedOnSessionClose (): boolean {
|
||||
if (this.isDisconnectedByHand) {
|
||||
return false
|
||||
}
|
||||
return super.doesTabShouldBeDestroyedOnSessionClosed()
|
||||
return super.shouldTabBeDestroyedOnSessionClose()
|
||||
}
|
||||
|
||||
async getRecoveryToken (options?: GetRecoveryTokenOptions): Promise<RecoveryToken> {
|
||||
|
Reference in New Issue
Block a user