reapply screen config on reattach

This commit is contained in:
Eugene Pankov 2017-07-24 16:04:17 +02:00
parent a26b38f5ae
commit 9bee253dd0
2 changed files with 27 additions and 20 deletions

View file

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

View file

@ -64,7 +64,7 @@ export class ScreenPersistenceProvider extends SessionPersistenceProvider {
recoveryId,
recoveredTruePID$: truePID$.asObservable(),
command: 'screen',
args: ['-d', '-r', recoveryId],
args: ['-d', '-r', recoveryId, '-c', await this.prepareConfig()],
}
}
@ -85,26 +85,8 @@ export class ScreenPersistenceProvider extends SessionPersistenceProvider {
}
async startSession (options: SessionOptions): Promise<any> {
let configPath = '/tmp/.termScreenConfig'
await fs.writeFile(configPath, `
escape ^^^
vbell off
deflogin on
defflow off
term xterm-color
bindkey "^[OH" beginning-of-line
bindkey "^[OF" end-of-line
bindkey "\\027[?1049h" stuff ----alternate enter-----
bindkey "\\027[?1049l" stuff ----alternate leave-----
termcapinfo xterm* 'hs:ts=\\E]0;:fs=\\007:ds=\\E]0;\\007'
defhstatus "^Et"
hardstatus off
altscreen on
defutf8 on
defencoding utf8
`, 'utf-8')
let recoveryId = `term-tab-${Date.now()}`
let args = ['-d', '-m', '-c', configPath, '-U', '-S', recoveryId, '-T', 'xterm-256color', '--', '-' + options.command].concat(options.args || [])
let args = ['-d', '-m', '-c', await this.prepareConfig(), '-U', '-S', recoveryId, '-T', 'xterm-256color', '--', '-' + options.command].concat(options.args || [])
this.logger.debug('Spawning screen with', args.join(' '))
await spawn('screen', args, {
cwd: options.cwd,
@ -120,4 +102,28 @@ export class ScreenPersistenceProvider extends SessionPersistenceProvider {
// screen has already quit
}
}
private async prepareConfig (): Promise<string> {
let configPath = '/tmp/.termScreenConfig'
await fs.writeFile(configPath, `
escape ^^^
vbell off
deflogin on
defflow off
term xterm-color
bindkey "^[OH" beginning-of-line
bindkey "^[OF" end-of-line
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "\\027[?1049h" stuff ----alternate enter-----
bindkey "\\027[?1049l" stuff ----alternate leave-----
termcapinfo xterm* 'hs:ts=\\E]0;:fs=\\007:ds=\\E]0;\\007'
defhstatus "^Et"
hardstatus off
altscreen on
defutf8 on
defencoding utf8
`, 'utf-8')
return configPath
}
}