mirror of
https://github.com/tsl0922/ttyd.git
synced 2026-01-09 12:24:21 +01:00
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:
@@ -16,6 +16,7 @@ const clientOptions = {
|
||||
enableTrzsz: false,
|
||||
enableSixel: false,
|
||||
isWindows: false,
|
||||
unicodeVersion: '11',
|
||||
} as ClientOptions;
|
||||
const termOptions = {
|
||||
fontSize: 13,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user