1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-09-21 18:07:54 +03:00

fixed home/end keys with conpty (fixes #587)

This commit is contained in:
Eugene Pankov 2019-03-18 22:00:43 +01:00
parent b9cbe4f12d
commit a7d62b0234
2 changed files with 24 additions and 6 deletions

View File

@ -110,12 +110,6 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
case 'reset-zoom': case 'reset-zoom':
this.resetZoom() this.resetZoom()
break break
case 'home':
this.sendInput('\x1bOH')
break
case 'end':
this.sendInput('\x1bOF')
break
case 'previous-word': case 'previous-word':
this.sendInput('\x1bb') this.sendInput('\x1bb')
break break

View File

@ -1,9 +1,11 @@
import { Component, Input } from '@angular/core' import { Component, Input } from '@angular/core'
import { Subscription } from 'rxjs'
import { first } from 'rxjs/operators' import { first } from 'rxjs/operators'
import { BaseTabProcess } from 'terminus-core' import { BaseTabProcess } from 'terminus-core'
import { BaseTerminalTabComponent } from './baseTerminalTab.component' import { BaseTerminalTabComponent } from './baseTerminalTab.component'
import { SessionOptions } from '../api' import { SessionOptions } from '../api'
import { Session } from '../services/sessions.service' import { Session } from '../services/sessions.service'
import { WIN_BUILD_CONPTY_SUPPORTED, isWindowsBuild } from '../utils'
/** @hidden */ /** @hidden */
@Component({ @Component({
@ -13,11 +15,28 @@ import { Session } from '../services/sessions.service'
}) })
export class TerminalTabComponent extends BaseTerminalTabComponent { export class TerminalTabComponent extends BaseTerminalTabComponent {
@Input() sessionOptions: SessionOptions @Input() sessionOptions: SessionOptions
private homeEndSubscription: Subscription
ngOnInit () { ngOnInit () {
this.logger = this.log.create('terminalTab') this.logger = this.log.create('terminalTab')
this.session = new Session(this.config) this.session = new Session(this.config)
let isConPTY = isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED) && this.config.store.terminal.useConPTY
this.homeEndSubscription = this.hotkeys.matchedHotkey.subscribe(hotkey => {
if (!this.hasFocus) {
return
}
switch (hotkey) {
case 'home':
this.sendInput(isConPTY ? '\x1b[H' : '\x1bOH')
break
case 'end':
this.sendInput(isConPTY ? '\x1b[F' : '\x1bOF')
break
}
})
this.frontendReady$.pipe(first()).subscribe(() => { this.frontendReady$.pipe(first()).subscribe(() => {
this.initializeSession(this.size.columns, this.size.rows) this.initializeSession(this.size.columns, this.size.rows)
}) })
@ -73,4 +92,9 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
} }
)).response === 1 )).response === 1
} }
ngOnDestroy () {
this.homeEndSubscription.unsubscribe()
super.ngOnDestroy()
}
} }