1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-28 05:36:31 +03:00

properly recover tabs with xterm

This commit is contained in:
Eugene Pankov 2019-01-27 22:01:55 +01:00
parent fab21f6859
commit 792de65696
4 changed files with 21 additions and 4 deletions

View File

@ -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)
}
}

View File

@ -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',

View File

@ -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()

View File

@ -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()