mirror of
https://github.com/Eugeny/tabby
synced 2024-11-14 08:57:21 +00:00
.
This commit is contained in:
parent
84341fb09a
commit
755d626f3d
3 changed files with 15 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Component, ElementRef, Input, trigger, style, animate, transition, state } from '@angular/core'
|
||||
import { Component, Input, trigger, style, animate, transition, state } from '@angular/core'
|
||||
import { ToasterConfig } from 'angular2-toaster'
|
||||
|
||||
import { ElectronService } from 'services/electron'
|
||||
|
@ -47,7 +47,6 @@ export class AppComponent {
|
|||
lastTabIndex = 0
|
||||
|
||||
constructor(
|
||||
private elementRef: ElementRef,
|
||||
private sessions: SessionsService,
|
||||
private docking: DockingService,
|
||||
private electron: ElectronService,
|
||||
|
@ -162,14 +161,10 @@ export class AppComponent {
|
|||
}
|
||||
if (this.activeTab) {
|
||||
this.activeTab.hasActivity = false
|
||||
this.activeTab.blurred.emit()
|
||||
}
|
||||
this.activeTab = tab
|
||||
setImmediate(() => {
|
||||
let iframe = this.elementRef.nativeElement.querySelector(':scope .tab.active iframe')
|
||||
if (iframe) {
|
||||
iframe.focus()
|
||||
}
|
||||
})
|
||||
this.activeTab.focused.emit()
|
||||
}
|
||||
|
||||
toggleLastTab () {
|
||||
|
|
|
@ -20,6 +20,7 @@ export class TerminalTabComponent extends BaseTabComponent<TerminalTab> {
|
|||
@Output() titleChange = new EventEmitter()
|
||||
terminal: any
|
||||
configSubscription: Subscription
|
||||
focusedSubscription: Subscription
|
||||
startupTime: number
|
||||
|
||||
constructor(
|
||||
|
@ -36,7 +37,10 @@ export class TerminalTabComponent extends BaseTabComponent<TerminalTab> {
|
|||
}
|
||||
|
||||
initTab () {
|
||||
let io
|
||||
this.focusedSubscription = this.model.focused.subscribe(() => {
|
||||
this.terminal.scrollPort_.focus()
|
||||
})
|
||||
|
||||
this.terminal = new hterm.hterm.Terminal()
|
||||
this.pluginDispatcher.emit('preTerminalInit', { terminal: this.terminal })
|
||||
this.terminal.setWindowTitle = (title) => {
|
||||
|
@ -47,7 +51,7 @@ export class TerminalTabComponent extends BaseTabComponent<TerminalTab> {
|
|||
}
|
||||
this.terminal.onTerminalReady = () => {
|
||||
this.terminal.installKeyboard()
|
||||
io = this.terminal.io.push()
|
||||
let io = this.terminal.io.push()
|
||||
const dataSubscription = this.model.session.dataAvailable.subscribe((data) => {
|
||||
if (performance.now() - this.startupTime > 500) {
|
||||
this.zone.run(() => {
|
||||
|
@ -88,6 +92,7 @@ export class TerminalTabComponent extends BaseTabComponent<TerminalTab> {
|
|||
}
|
||||
|
||||
ngOnDestroy () {
|
||||
this.focusedSubscription.unsubscribe()
|
||||
this.configSubscription.unsubscribe()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { EventEmitter } from '@angular/core'
|
||||
import { BaseTabComponent } from 'components/baseTab'
|
||||
import { Session } from 'services/sessions'
|
||||
|
||||
|
@ -8,6 +9,8 @@ export class Tab {
|
|||
title: string
|
||||
scrollable: boolean
|
||||
hasActivity = false
|
||||
focused = new EventEmitter<any>()
|
||||
blurred = new EventEmitter<any>()
|
||||
static lastTabID = 0
|
||||
|
||||
constructor () {
|
||||
|
@ -51,4 +54,6 @@ export class TerminalTab extends Tab {
|
|||
getComponentType (): ComponentType<TerminalTab> {
|
||||
return TerminalTabComponent
|
||||
}
|
||||
|
||||
onFocus (): void { }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue