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