mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-26 12:03:31 +03:00
fixed home/end keys with conpty (fixes #587)
This commit is contained in:
parent
b9cbe4f12d
commit
a7d62b0234
@ -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
|
||||||
|
@ -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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user