mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-25 13:59:52 +00:00
Revert "resolves Eugeny/tabby#7751, Eugeny/tabby#8062, Eugeny/tabby#6617 add configurable behavior when session ends"
This reverts commit 268af8806cefc8dba071ead3a03870acdcf39a8e.
This commit is contained in:
parent
8cb75e14a2
commit
f423be1510
@ -25,7 +25,6 @@ terminal:
|
|||||||
paneResizeStep: 0.1
|
paneResizeStep: 0.1
|
||||||
focusFollowsMouse: false
|
focusFollowsMouse: false
|
||||||
identification: null
|
identification: null
|
||||||
behaviorOnSessionEnds: 'keep-open'
|
|
||||||
hotkeys:
|
hotkeys:
|
||||||
profile:
|
profile:
|
||||||
__nonStructural: true
|
__nonStructural: true
|
||||||
|
@ -28,6 +28,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent<LocalProfile>
|
|||||||
this.sessionOptions = this.profile.options
|
this.sessionOptions = this.profile.options
|
||||||
|
|
||||||
this.logger = this.log.create('terminalTab')
|
this.logger = this.log.create('terminalTab')
|
||||||
|
this.session = new Session(this.injector)
|
||||||
|
|
||||||
const isConPTY = isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED) && this.config.store.terminal.useConPTY
|
const isConPTY = isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED) && this.config.store.terminal.useConPTY
|
||||||
|
|
||||||
@ -55,9 +56,6 @@ export class TerminalTabComponent extends BaseTerminalTabComponent<LocalProfile>
|
|||||||
}
|
}
|
||||||
|
|
||||||
initializeSession (columns: number, rows: number): void {
|
initializeSession (columns: number, rows: number): void {
|
||||||
|
|
||||||
const session = new Session(this.injector)
|
|
||||||
|
|
||||||
if (this.profile.options.runAsAdministrator && this.uac?.isAvailable) {
|
if (this.profile.options.runAsAdministrator && this.uac?.isAvailable) {
|
||||||
this.profile = {
|
this.profile = {
|
||||||
...this.profile,
|
...this.profile,
|
||||||
@ -65,13 +63,13 @@ export class TerminalTabComponent extends BaseTerminalTabComponent<LocalProfile>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
session.start({
|
this.session!.start({
|
||||||
...this.profile.options,
|
...this.profile.options,
|
||||||
width: columns,
|
width: columns,
|
||||||
height: rows,
|
height: rows,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.setSession(session, this.config.store.terminal.behaviorOnSessionEnds.endsWith('close'))
|
this.attachSessionHandlers(true)
|
||||||
this.recoveryStateChangedHint.next()
|
this.recoveryStateChangedHint.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,25 +82,12 @@ export class SerialTabComponent extends BaseTerminalTabComponent<SerialProfile>
|
|||||||
this.session?.resize(this.size.columns, this.size.rows)
|
this.session?.resize(this.size.columns, this.size.rows)
|
||||||
})
|
})
|
||||||
this.attachSessionHandler(this.session!.destroyed$, () => {
|
this.attachSessionHandler(this.session!.destroyed$, () => {
|
||||||
if (this.frontend) {
|
this.write(this.translate.instant(_('Press any key to reconnect')) + '\r\n')
|
||||||
// Session was closed abruptly
|
this.input$.pipe(first()).subscribe(() => {
|
||||||
if (this.config.store.terminal.behaviorOnSessionEnds == 'close') {
|
if (!this.session?.open) {
|
||||||
// Close the tab
|
|
||||||
this.destroy()
|
|
||||||
} else if (this.config.store.terminal.behaviorOnSessionEnds.startsWith('reconnect-or-')) {
|
|
||||||
// Automatically reconnect the session
|
|
||||||
this.reconnect()
|
this.reconnect()
|
||||||
} else {
|
|
||||||
// Reconnect Offer
|
|
||||||
this.write(this.translate.instant(_('Press any key to reconnect')) + '\r\n')
|
|
||||||
this.input$.pipe(first()).subscribe(() => {
|
|
||||||
if (!this.session?.open) {
|
|
||||||
this.reconnect()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
super.attachSessionHandlers()
|
super.attachSessionHandlers()
|
||||||
}
|
}
|
||||||
|
@ -157,27 +157,24 @@ export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> implem
|
|||||||
protected attachSessionHandlers (): void {
|
protected attachSessionHandlers (): void {
|
||||||
const session = this.session!
|
const session = this.session!
|
||||||
this.attachSessionHandler(session.destroyed$, () => {
|
this.attachSessionHandler(session.destroyed$, () => {
|
||||||
if (this.frontend) {
|
if (
|
||||||
|
// Ctrl-D
|
||||||
|
this.recentInputs.charCodeAt(this.recentInputs.length - 1) === 4 ||
|
||||||
|
this.recentInputs.endsWith('exit\r')
|
||||||
|
) {
|
||||||
|
// User closed the session
|
||||||
|
this.destroy()
|
||||||
|
} else if (this.frontend) {
|
||||||
|
// Session was closed abruptly
|
||||||
this.write('\r\n' + colors.black.bgWhite(' SSH ') + ` ${this.sshSession?.profile.options.host}: session closed\r\n`)
|
this.write('\r\n' + colors.black.bgWhite(' SSH ') + ` ${this.sshSession?.profile.options.host}: session closed\r\n`)
|
||||||
|
if (!this.reconnectOffered) {
|
||||||
if (this.config.store.terminal.behaviorOnSessionEnds == 'close') {
|
this.reconnectOffered = true
|
||||||
// Close the tab
|
this.write(this.translate.instant(_('Press any key to reconnect')) + '\r\n')
|
||||||
this.destroy()
|
this.input$.pipe(first()).subscribe(() => {
|
||||||
} else if (this.config.store.terminal.behaviorOnSessionEnds.startsWith('reconnect-or-')) {
|
if (!this.session?.open && this.reconnectOffered) {
|
||||||
// Automatically reconnect the session
|
this.reconnect()
|
||||||
this.reconnect()
|
}
|
||||||
} else {
|
})
|
||||||
// Reconnect Offer
|
|
||||||
if (!this.reconnectOffered) {
|
|
||||||
this.reconnectOffered = true
|
|
||||||
this.write(this.translate.instant(_('Press any key to reconnect')) + '\r\n')
|
|
||||||
this.input$.pipe(first()).subscribe(() => {
|
|
||||||
if (!this.session?.open && this.reconnectOffered) {
|
|
||||||
this.reconnect()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -48,23 +48,14 @@ export class TelnetTabComponent extends BaseTerminalTabComponent<TelnetProfile>
|
|||||||
this.attachSessionHandler(session.destroyed$, () => {
|
this.attachSessionHandler(session.destroyed$, () => {
|
||||||
if (this.frontend) {
|
if (this.frontend) {
|
||||||
// Session was closed abruptly
|
// Session was closed abruptly
|
||||||
if (this.config.store.terminal.behaviorOnSessionEnds == 'close') {
|
if (!this.reconnectOffered) {
|
||||||
// Close the tab
|
this.reconnectOffered = true
|
||||||
this.destroy()
|
this.write(this.translate.instant(_('Press any key to reconnect')) + '\r\n')
|
||||||
} else if (this.config.store.terminal.behaviorOnSessionEnds.startsWith('reconnect-or-')) {
|
this.input$.pipe(first()).subscribe(() => {
|
||||||
// Automatically reconnect the session
|
if (!this.session?.open && this.reconnectOffered) {
|
||||||
this.reconnect()
|
this.reconnect()
|
||||||
} else {
|
}
|
||||||
// Reconnect Offer
|
})
|
||||||
if (!this.reconnectOffered) {
|
|
||||||
this.reconnectOffered = true
|
|
||||||
this.write(this.translate.instant(_('Press any key to reconnect')) + '\r\n')
|
|
||||||
this.input$.pipe(first()).subscribe(() => {
|
|
||||||
if (!this.session?.open && this.reconnectOffered) {
|
|
||||||
this.reconnect()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -225,24 +225,6 @@ div.mt-4
|
|||||||
(ngModelChange)='config.save()',
|
(ngModelChange)='config.save()',
|
||||||
)
|
)
|
||||||
|
|
||||||
.mt-4
|
|
||||||
h3(translate) Closing
|
|
||||||
|
|
||||||
.form-line
|
|
||||||
.header
|
|
||||||
.title(translate) Tab's behavior when session ends
|
|
||||||
.description(*ngIf='config.store.terminal.behaviorOnSessionEnds.startsWith("reconnect-or")', translate) Automatically reconnect the Serial, Telnet or SSH session
|
|
||||||
|
|
||||||
select.form-control(
|
|
||||||
[(ngModel)]='config.store.terminal.behaviorOnSessionEnds',
|
|
||||||
(ngModelChange)='config.save()'
|
|
||||||
)
|
|
||||||
option(ngValue='keep-open', translate) Keep open
|
|
||||||
option(ngValue='reconnect-or-keep-open', translate) Reconnect, otherwise keep open
|
|
||||||
option(ngValue='reconnect-or-close', translate) Reconnect, otherwise close
|
|
||||||
option(ngValue='close', translate) Close
|
|
||||||
|
|
||||||
|
|
||||||
div.mt-4(*ngIf='hostApp.platform === Platform.Windows')
|
div.mt-4(*ngIf='hostApp.platform === Platform.Windows')
|
||||||
h3(translate) Windows
|
h3(translate) Windows
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ export class TerminalConfigProvider extends ConfigProvider {
|
|||||||
hideCloseButton: false,
|
hideCloseButton: false,
|
||||||
hideTabOptionsButton: false,
|
hideTabOptionsButton: false,
|
||||||
rightClick: 'menu',
|
rightClick: 'menu',
|
||||||
behaviorOnSessionEnds: 'keep-open',
|
|
||||||
pasteOnMiddleClick: true,
|
pasteOnMiddleClick: true,
|
||||||
copyOnSelect: false,
|
copyOnSelect: false,
|
||||||
copyAsHTML: true,
|
copyAsHTML: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user