This commit is contained in:
Eugene Pankov 2017-04-20 22:33:55 +02:00
parent d909c4a791
commit 82e0a9238d
4 changed files with 14 additions and 10 deletions

View File

@ -44,6 +44,9 @@ export class AppService {
} }
selectTab (tab: BaseTabComponent) { selectTab (tab: BaseTabComponent) {
if (this.activeTab == tab) {
return
}
if (this.tabs.includes(this.activeTab)) { if (this.tabs.includes(this.activeTab)) {
this.lastTabIndex = this.tabs.indexOf(this.activeTab) this.lastTabIndex = this.tabs.indexOf(this.activeTab)
} else { } else {

View File

@ -9,6 +9,8 @@
display: block; display: block;
overflow: hidden; overflow: hidden;
margin: 15px; margin: 15px;
transition: opacity ease-out 0.1s;
opacity: 0;
div[style]:last-child { div[style]:last-child {
background: black !important; background: black !important;

View File

@ -1,6 +1,6 @@
import { BehaviorSubject, ReplaySubject, Subject, Subscription } from 'rxjs' import { BehaviorSubject, ReplaySubject, Subject, Subscription } from 'rxjs'
import { Component, NgZone, Inject, ViewChild, HostBinding, Input } from '@angular/core' import { Component, NgZone, Inject, ViewChild, HostBinding, Input } from '@angular/core'
import { AppService, ConfigService, BaseTabComponent, ThemesService } from 'terminus-core' import { AppService, ConfigService, BaseTabComponent, ThemesService, HostAppService, Platform } from 'terminus-core'
import { Session } from '../services/sessions.service' import { Session } from '../services/sessions.service'
@ -10,7 +10,7 @@ import { hterm, preferenceManager } from '../hterm'
@Component({ @Component({
selector: 'terminalTab', selector: 'terminalTab',
template: '<div #content class="content"></div>', template: '<div #content class="content" [style.opacity]="htermVisible ? 1 : 0"></div>',
styles: [require('./terminalTab.component.scss')], styles: [require('./terminalTab.component.scss')],
}) })
export class TerminalTabComponent extends BaseTabComponent { export class TerminalTabComponent extends BaseTabComponent {
@ -24,6 +24,7 @@ export class TerminalTabComponent extends BaseTabComponent {
contentUpdated$ = new Subject<void>() contentUpdated$ = new Subject<void>()
alternateScreenActive$ = new BehaviorSubject(false) alternateScreenActive$ = new BehaviorSubject(false)
mouseEvent$ = new Subject<Event>() mouseEvent$ = new Subject<Event>()
htermVisible = false
@Input() session: Session @Input() session: Session
@ViewChild('content') content @ViewChild('content') content
@HostBinding('style.background-color') backgroundColor: string @HostBinding('style.background-color') backgroundColor: string
@ -33,6 +34,7 @@ export class TerminalTabComponent extends BaseTabComponent {
private zone: NgZone, private zone: NgZone,
private app: AppService, private app: AppService,
private themes: ThemesService, private themes: ThemesService,
private hostApp: HostAppService,
public config: ConfigService, public config: ConfigService,
@Inject(TerminalDecorator) private decorators: TerminalDecorator[], @Inject(TerminalDecorator) private decorators: TerminalDecorator[],
) { ) {
@ -63,6 +65,7 @@ export class TerminalTabComponent extends BaseTabComponent {
this.attachHTermHandlers(this.hterm) this.attachHTermHandlers(this.hterm)
this.hterm.onTerminalReady = () => { this.hterm.onTerminalReady = () => {
this.htermVisible = true
this.hterm.installKeyboard() this.hterm.installKeyboard()
this.io = this.hterm.io.push() this.io = this.hterm.io.push()
this.attachIOHandlers(this.io) this.attachIOHandlers(this.io)
@ -106,12 +109,6 @@ export class TerminalTabComponent extends BaseTabComponent {
}) })
} }
const _decorate = hterm.scrollPort_.decorate.bind(hterm.scrollPort_)
hterm.scrollPort_.decorate = (...args) => {
_decorate(...args)
hterm.scrollPort_.screen_.style.cssText += `; padding-right: ${hterm.scrollPort_.screen_.offsetWidth - hterm.scrollPort_.screen_.clientWidth}px;`
}
const _setAlternateMode = hterm.setAlternateMode.bind(hterm) const _setAlternateMode = hterm.setAlternateMode.bind(hterm)
hterm.setAlternateMode = (state) => { hterm.setAlternateMode = (state) => {
_setAlternateMode(state) _setAlternateMode(state)
@ -198,6 +195,8 @@ export class TerminalTabComponent extends BaseTabComponent {
preferenceManager.set('enable-clipboard-notice', false) preferenceManager.set('enable-clipboard-notice', false)
preferenceManager.set('receive-encoding', 'raw') preferenceManager.set('receive-encoding', 'raw')
preferenceManager.set('send-encoding', 'raw') preferenceManager.set('send-encoding', 'raw')
preferenceManager.set('ctrl-plus-minus-zero-zoom', false)
preferenceManager.set('scrollbar-visible', this.hostApp.platform == Platform.macOS)
if (config.terminal.colorScheme.foreground) { if (config.terminal.colorScheme.foreground) {
preferenceManager.set('foreground-color', config.terminal.colorScheme.foreground) preferenceManager.set('foreground-color', config.terminal.colorScheme.foreground)
@ -210,7 +209,7 @@ export class TerminalTabComponent extends BaseTabComponent {
} else { } else {
this.backgroundColor = null this.backgroundColor = null
// hterm can't parse "transparent" // hterm can't parse "transparent"
preferenceManager.set('background-color', themes.findCurrentTheme().terminalBackground) preferenceManager.set('background-color', this.themes.findCurrentTheme().terminalBackground)
} }
if (config.terminal.colorScheme.colors) { if (config.terminal.colorScheme.colors) {
preferenceManager.set('color-palette-overrides', config.terminal.colorScheme.colors) preferenceManager.set('color-palette-overrides', config.terminal.colorScheme.colors)

View File

@ -6,7 +6,7 @@ export class TerminalConfigProvider extends ConfigProvider {
terminal: { terminal: {
fontSize: 14, fontSize: 14,
bell: 'off', bell: 'off',
bracketedPaste: true, bracketedPaste: false,
background: 'theme', background: 'theme',
colorScheme: { colorScheme: {
__nonStructural: true, __nonStructural: true,