An addon providing Unicode version 11 character width rules for xterm.js terminal emulator.
npx @tessl/cli install tessl/npm-xterm--addon-unicode11@0.6.0@xterm/addon-unicode11 provides Unicode version 11 character width rules for xterm.js terminal emulator. It enables accurate text rendering and cursor positioning for modern Unicode characters, emojis, and complex text by implementing Unicode 11 standards for character cell width calculations.
npm install @xterm/addon-unicode11import { Unicode11Addon } from "@xterm/addon-unicode11";For CommonJS:
const { Unicode11Addon } = require("@xterm/addon-unicode11");import { Terminal } from "@xterm/xterm";
import { Unicode11Addon } from "@xterm/addon-unicode11";
// Create terminal and addon instances
const terminal = new Terminal();
const unicode11Addon = new Unicode11Addon();
// Load the addon onto the terminal
terminal.loadAddon(unicode11Addon);
// Activate Unicode version 11 support
terminal.unicode.activeVersion = "11";
// The terminal now uses Unicode 11 character width rules
// for proper rendering of modern Unicode characters and emojisThe addon integrates with xterm.js through the terminal's unicode registry system. When activated, it registers a Unicode version provider that implements Unicode 11 character width calculation rules. The addon follows the standard xterm.js addon pattern using the ITerminalAddon interface.
Key components:
ITerminalAddonIUnicodeVersionProviderMain addon class that provides Unicode version 11 support to xterm.js terminals.
/**
* Unicode version 11 addon for xterm.js terminals
* Implements ITerminalAddon interface for standard addon integration
*/
class Unicode11Addon implements ITerminalAddon {
constructor();
/**
* Activates the addon on a terminal instance
* Registers the Unicode V11 provider with the terminal's unicode registry
* @param terminal - The xterm.js terminal instance to activate on
*/
activate(terminal: Terminal): void;
/**
* Disposes of the addon resources
* Currently a no-op implementation
*/
dispose(): void;
}Usage Example:
import { Terminal } from "@xterm/xterm";
import { Unicode11Addon } from "@xterm/addon-unicode11";
const terminal = new Terminal();
const addon = new Unicode11Addon();
// Standard addon loading pattern
terminal.loadAddon(addon);
// Unicode 11 is now available as a version option
console.log(terminal.unicode.versions); // includes "11"
// Activate Unicode 11 character width rules
terminal.unicode.activeVersion = "11";
// Test with Unicode 11 characters like modern emojis
terminal.write("🤣🤣🤣🤣🤣"); // Proper character width calculationStandard xterm.js addon interface (from @xterm/xterm):
interface ITerminalAddon {
activate(terminal: Terminal): void;
dispose(): void;
}The addon integrates with the existing xterm.js Unicode system:
// Available on terminal.unicode after loading the addon
interface UnicodeApi {
versions: string[]; // Available Unicode versions (includes "11")
activeVersion: string; // Currently active version
register(provider: IUnicodeVersionProvider): void;
}When Unicode version 11 is active, the terminal uses the following character width rules:
This ensures proper:
The addon follows standard xterm.js patterns: