From 206123615e883e90f19d5f6e8dfad06dfe68ae68 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Wed, 4 Jan 2023 14:09:19 +0100 Subject: [PATCH] ssh: handle Unicode characters that are chopped up between chunks --- tabby-ssh/src/session/shell.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tabby-ssh/src/session/shell.ts b/tabby-ssh/src/session/shell.ts index 4f1b4cf60d..7a98697aa1 100644 --- a/tabby-ssh/src/session/shell.ts +++ b/tabby-ssh/src/session/shell.ts @@ -6,6 +6,7 @@ import { LogService } from 'tabby-core' import { BaseSession } from 'tabby-terminal' import { SSHSession } from './ssh' import { SSHProfile } from '../api' +import { UTF8Splitter } from '../../../app/lib/utfSplitter' export class SSHShellSession extends BaseSession { @@ -13,6 +14,7 @@ export class SSHShellSession extends BaseSession { get serviceMessage$ (): Observable { return this.serviceMessage } private serviceMessage = new Subject() private ssh: SSHSession|null + private decoder = new UTF8Splitter() constructor ( injector: Injector, @@ -60,10 +62,14 @@ export class SSHShellSession extends BaseSession { }) this.shell.on('data', data => { - this.emitOutput(data) + this.emitOutput(this.decoder.write(data)) }) this.shell.on('end', () => { + const remainder = this.decoder.flush() + if (remainder.length) { + this.emitOutput(remainder) + } this.logger.info('Shell session ended') if (this.open) { this.destroy()