From 9705a1b5b5c7ad0c96bb35a52597e53ba4263939 Mon Sep 17 00:00:00 2001 From: Nikolaos Stefanou Date: Wed, 19 Feb 2020 12:45:18 +0000 Subject: [PATCH] resolves #1988 --- .../src/components/sshTab.component.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/terminus-ssh/src/components/sshTab.component.ts b/terminus-ssh/src/components/sshTab.component.ts index 378af624..b5d94fb3 100644 --- a/terminus-ssh/src/components/sshTab.component.ts +++ b/terminus-ssh/src/components/sshTab.component.ts @@ -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) 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() + } }