html: Add Unicode 11 xterm.js addon (#1310)

* html: Add Unicode 11 xterm.js addon

Add Unicode 11 addon to xterm.js to enable support for newer Unicode
standards. This addon significantly improves rendering of emojis.

Signed-off-by: Michael Lorant <michael.lorant@nine.com.au>

* html: rebuild header file

---------

Signed-off-by: Michael Lorant <michael.lorant@nine.com.au>
Co-authored-by: Shuanglei Tao <tsl0922@gmail.com>
This commit is contained in:
Michael Lorant
2024-03-05 18:19:47 +11:00
committed by GitHub
parent 09e7fd8148
commit 61a985e74e
5 changed files with 13877 additions and 13491 deletions

View File

@@ -16,6 +16,7 @@ const clientOptions = {
enableTrzsz: false,
enableSixel: false,
isWindows: false,
unicodeVersion: '11',
} as ClientOptions;
const termOptions = {
fontSize: 13,

View File

@@ -5,6 +5,7 @@ import { WebglAddon } from '@xterm/addon-webgl';
import { FitAddon } from '@xterm/addon-fit';
import { WebLinksAddon } from '@xterm/addon-web-links';
import { ImageAddon } from '@xterm/addon-image';
import { Unicode11Addon } from '@xterm/addon-unicode11';
import { OverlayAddon } from './addons/overlay';
import { ZmodemAddon } from './addons/zmodem';
@@ -46,6 +47,7 @@ export interface ClientOptions {
titleFixed?: string;
isWindows: boolean;
trzszDragInitTimeout: number;
unicodeVersion: string;
}
export interface FlowControl {
@@ -386,6 +388,21 @@ export class Xterm {
case 'isWindows':
if (value) console.log('[ttyd] is windows');
break;
case 'unicodeVersion':
switch (value) {
case 6:
case '6':
console.log('[ttyd] setting Unicode version: 6');
break;
case 11:
case '11':
default:
console.log('[ttyd] setting Unicode version: 11');
terminal.loadAddon(new Unicode11Addon());
terminal.unicode.activeVersion = '11';
break;
}
break;
default:
console.log(`[ttyd] option: ${key}=${JSON.stringify(value)}`);
if (terminal.options[key] instanceof Object) {