mirror of
https://github.com/Eugeny/tabby.git
synced 2024-11-30 22:53:31 +03:00
properly recover tabs with xterm
This commit is contained in:
parent
fab21f6859
commit
792de65696
@ -105,7 +105,9 @@ export class AppService {
|
||||
this.activeTab = tab
|
||||
this.activeTabChange.next(tab)
|
||||
if (this.activeTab) {
|
||||
setImmediate(() => {
|
||||
this.activeTab.emitFocused()
|
||||
})
|
||||
this.hostApp.setTitle(this.activeTab.title)
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ div(*ngIf='npmInstalled')
|
||||
.input-group.mb-3
|
||||
.input-group-prepend
|
||||
.input-group-text
|
||||
i.fas.fa-fw.fa-circle-o-notch.fa-spin(*ngIf='!availablePluginsReady')
|
||||
i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='!availablePluginsReady')
|
||||
i.fas.fa-fw.fa-search(*ngIf='availablePluginsReady')
|
||||
input.form-control(
|
||||
type='text',
|
||||
|
@ -145,7 +145,15 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
||||
})
|
||||
|
||||
this.frontend.configure()
|
||||
|
||||
if (this.hasFocus) {
|
||||
this.frontend.attach(this.content.nativeElement)
|
||||
} else {
|
||||
this.focused$.pipe(first()).subscribe(() => {
|
||||
this.frontend.attach(this.content.nativeElement)
|
||||
})
|
||||
}
|
||||
|
||||
this.attachTermContainerHandlers()
|
||||
|
||||
this.configure()
|
||||
|
@ -54,6 +54,14 @@ export class XTermFrontend extends Frontend {
|
||||
|
||||
this.xtermCore._scrollToBottom = this.xtermCore.scrollToBottom.bind(this.xtermCore)
|
||||
this.xtermCore.scrollToBottom = () => null
|
||||
|
||||
this.resizeHandler = () => {
|
||||
try {
|
||||
(this.xterm as any).fit()
|
||||
} catch {
|
||||
// tends to throw when element wasn't shown yet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
attach (host: HTMLElement): void {
|
||||
@ -61,7 +69,6 @@ export class XTermFrontend extends Frontend {
|
||||
this.ready.next(null)
|
||||
this.ready.complete()
|
||||
|
||||
this.resizeHandler = () => (this.xterm as any).fit()
|
||||
window.addEventListener('resize', this.resizeHandler)
|
||||
|
||||
this.resizeHandler()
|
||||
|
Loading…
Reference in New Issue
Block a user