Merge pull request #2148 from nstefanou/master

resolves #1988
This commit is contained in:
Eugene 2020-02-24 11:56:29 +01:00 committed by GitHub
commit 8cef4e5cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import { BaseTerminalTabComponent } from 'terminus-terminal'
import { SSHService } from '../services/ssh.service'
import { SSHConnection, SSHSession } from '../api'
import { SSHPortForwardingModalComponent } from './sshPortForwardingModal.component'
import {Subscription} from "rxjs";
/** @hidden */
@Component({
@ -20,12 +21,28 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
ssh: SSHService
session: SSHSession
private ngbModal: NgbModal
private homeEndSubscription: Subscription
ngOnInit () {
this.ngbModal = this.injector.get<NgbModal>(NgbModal)
this.logger = this.log.create('terminalTab')
this.ssh = this.injector.get(SSHService)
this.homeEndSubscription = this.hotkeys.matchedHotkey.subscribe(hotkey => {
if (!this.hasFocus) {
return
}
switch (hotkey) {
case 'home':
this.sendInput('\x1b[H' )
break
case 'end':
this.sendInput('\x1b[F' )
break
}
})
this.frontendReady$.pipe(first()).subscribe(() => {
this.initializeSession()
})
@ -92,4 +109,9 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
reconnect () {
this.initializeSession()
}
ngOnDestroy () {
this.homeEndSubscription.unsubscribe()
super.ngOnDestroy()
}
}