mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-23 02:22:02 +03:00
fixed tab title recovery for split tabs - fixes #4810
This commit is contained in:
parent
b755346ac0
commit
433c7d33d9
@ -90,6 +90,7 @@ class PTYDataQueue {
|
||||
export class PTY {
|
||||
private pty: nodePTY.IPty
|
||||
private outputQueue: PTYDataQueue
|
||||
exited = false
|
||||
|
||||
constructor (private id: string, private app: Application, ...args: any[]) {
|
||||
this.pty = (nodePTY as any).spawn(...args)
|
||||
@ -101,7 +102,10 @@ export class PTY {
|
||||
setImmediate(() => this.emit('data', data))
|
||||
})
|
||||
|
||||
this.pty.on('data', data => this.outputQueue.push(Buffer.from(data)))
|
||||
this.pty.onData(data => this.outputQueue.push(Buffer.from(data)))
|
||||
this.pty.onExit(() => {
|
||||
this.exited = true
|
||||
})
|
||||
}
|
||||
|
||||
getPID (): number {
|
||||
@ -144,7 +148,7 @@ export class PTYManager {
|
||||
})
|
||||
|
||||
ipcMain.on('pty:exists', (event, id) => {
|
||||
event.returnValue = !!this.ptys[id]
|
||||
event.returnValue = !this.ptys[id]?.exited
|
||||
})
|
||||
|
||||
ipcMain.on('pty:get-pid', (event, id) => {
|
||||
|
@ -108,13 +108,13 @@ export class AppRootComponent {
|
||||
if (hotkey === 'move-tab-right') {
|
||||
this.app.moveSelectedTabRight()
|
||||
}
|
||||
if (hotkey === 'reopen-tab') {
|
||||
this.app.reopenLastTab()
|
||||
}
|
||||
if (hotkey === 'duplicate-tab') {
|
||||
this.app.duplicateTab(this.app.activeTab)
|
||||
}
|
||||
}
|
||||
if (hotkey === 'reopen-tab') {
|
||||
this.app.reopenLastTab()
|
||||
}
|
||||
if (hotkey === 'toggle-fullscreen') {
|
||||
hostWindow.toggleFullscreen()
|
||||
}
|
||||
|
@ -306,6 +306,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
||||
async ngAfterViewInit (): Promise<void> {
|
||||
if (this._recoveredState) {
|
||||
await this.recoverContainer(this.root, this._recoveredState, this._recoveredState.duplicate)
|
||||
this.updateTitle()
|
||||
this.layout()
|
||||
setTimeout(() => {
|
||||
if (this.hasFocus) {
|
||||
|
@ -102,13 +102,6 @@ export class AppService {
|
||||
})
|
||||
|
||||
hostWindow.windowFocused$.subscribe(() => this._activeTab?.emitFocused())
|
||||
|
||||
this.tabClosed$.subscribe(async tab => {
|
||||
const token = await tabRecovery.getFullRecoveryToken(tab)
|
||||
if (token) {
|
||||
this.closedTabsStack.push(token)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
addTabRaw (tab: BaseTabComponent, index: number|null = null): void {
|
||||
@ -317,6 +310,10 @@ export class AppService {
|
||||
if (checkCanClose && !await tab.canClose()) {
|
||||
return
|
||||
}
|
||||
const token = await this.tabRecovery.getFullRecoveryToken(tab)
|
||||
if (token) {
|
||||
this.closedTabsStack.push(token)
|
||||
}
|
||||
tab.destroy()
|
||||
}
|
||||
|
||||
|
@ -295,18 +295,16 @@ export class Session extends BaseSession {
|
||||
} else {
|
||||
await new Promise<void>((resolve) => {
|
||||
this.kill('SIGTERM')
|
||||
setImmediate(() => {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
process.kill(this.pty!.getPID(), 0)
|
||||
// still alive
|
||||
setTimeout(() => {
|
||||
this.kill('SIGKILL')
|
||||
resolve()
|
||||
}, 1000)
|
||||
this.kill('SIGKILL')
|
||||
resolve()
|
||||
} catch {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user