This commit is contained in:
Eugene Pankov
2017-07-26 19:29:47 +02:00
parent 5045c4c82a
commit 98a5a95bec
9 changed files with 47 additions and 23 deletions

View File

@@ -51,7 +51,9 @@ export class TerminalTabComponent extends BaseTabComponent {
this.session = this.sessions.addSession(
Object.assign({}, this.sessionOptions, resizeEvent)
)
this.session.resize(resizeEvent.width, resizeEvent.height)
setTimeout(() => {
this.session.resize(resizeEvent.width, resizeEvent.height)
}, 1000)
// this.session.output$.bufferTime(10).subscribe((datas) => {
this.session.output$.subscribe(data => {
// let data = datas.join('')

View File

@@ -67,8 +67,9 @@ hterm.hterm.VT.CSI[' q'] = function (parseState) {
this.terminal.applyCursorShape()
}
const _collapseToEnd = Selection.prototype.collapseToEnd
Selection.prototype.collapseToEnd = function () {
try {
this.collapseToEnd()
_collapseToEnd.apply(this)
} catch (err) { ; }
}

View File

@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'
import { TabRecoveryProvider, AppService } from 'terminus-core'
import { TabRecoveryProvider, RecoveredTab } from 'terminus-core'
import { TerminalTabComponent } from './components/terminalTab.component'
import { SessionsService } from './services/sessions.service'
@@ -8,18 +8,21 @@ import { SessionsService } from './services/sessions.service'
export class RecoveryProvider extends TabRecoveryProvider {
constructor (
private sessions: SessionsService,
private app: AppService,
) {
super()
}
async recover (recoveryToken: any): Promise<void> {
async recover (recoveryToken: any): Promise<RecoveredTab> {
if (recoveryToken.type === 'app:terminal') {
let sessionOptions = await this.sessions.recover(recoveryToken.recoveryId)
if (!sessionOptions) {
return
}
this.app.openNewTab(TerminalTabComponent, { sessionOptions })
return {
type: TerminalTabComponent,
options: { sessionOptions },
}
}
return null
}
}

View File

@@ -6,6 +6,15 @@ import { SessionOptions, SessionPersistenceProvider } from './api'
const TMUX_CONFIG = `
set -g status off
set -g focus-events on
set -g bell-action any
set -g bell-on-alert on
set -g visual-bell off
set -g set-titles on
set -g set-titles-string "#W"
set -g window-status-format '#I:#(pwd="#{pane_current_path}"; echo \${pwd####*/})#F'
set -g window-status-current-format '#I:#(pwd="#{pane_current_path}"; echo \${pwd####*/})#F'
set-option -g status-interval 1
`
export class TMuxBlock {
@@ -44,7 +53,7 @@ export class TMuxCommandProcess {
this.process = childProcess.spawn('tmux', ['-C', '-L', 'terminus', 'new-session', '-A', '-D', '-s', 'control'])
console.log('[tmux] started')
this.process.stdout.on('data', data => {
console.debug('tmux says:', data.toString())
// console.debug('tmux says:', data.toString())
this.rawOutput$.next(data.toString())
})