mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Add powerline to glyph ranges test
This commit is contained in:
@@ -63,7 +63,7 @@ export const unifiedCharDefinitions: { [index: string]: CustomGlyphCharacterDefi
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Powerline symbols (E0A0-E0BF)
|
||||
// #region Powerline Symbols (E0A0-E0BF)
|
||||
|
||||
// This contains the definitions of the primarily used box drawing characters as vector shapes.
|
||||
// The reason these characters are defined specially is to avoid common problems if a user's font
|
||||
@@ -89,6 +89,9 @@ export const unifiedCharDefinitions: { [index: string]: CustomGlyphCharacterDefi
|
||||
'\u{E0B2}': { type: CustomGlyphDefinitionType.VECTOR_SHAPE, data: { d: 'M1,0 L0,.5 L1,1', type: CustomGlyphVectorType.FILL, leftPadding: 2 } },
|
||||
// Left triangle line
|
||||
'\u{E0B3}': { type: CustomGlyphDefinitionType.VECTOR_SHAPE, data: { d: 'M2,-.5 L0,.5 L2,1.5', type: CustomGlyphVectorType.STROKE, leftPadding: 1, rightPadding: 1 } },
|
||||
|
||||
// Powerline Extra Symbols
|
||||
|
||||
// Right semi-circle solid
|
||||
'\u{E0B4}': { type: CustomGlyphDefinitionType.VECTOR_SHAPE, data: { d: 'M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0', type: CustomGlyphVectorType.FILL, rightPadding: 1 } },
|
||||
// Right semi-circle line
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
|
||||
import { blockElementDefinitions, boxDrawingDefinitions, powerlineDefinitions, unifiedCharDefinitions } from 'customGlyphs/CustomGlyphDefinitions';
|
||||
import { blockElementDefinitions, boxDrawingDefinitions, unifiedCharDefinitions } from 'customGlyphs/CustomGlyphDefinitions';
|
||||
import { CustomGlyphDefinitionType, CustomGlyphVectorType, type CustomGlyphPathDrawFunctionDefinition, type CustomGlyphPatternDefinition, type CustomGlyphRegionDefinition, type ICustomGlyphSolidOctantBlockVector, type ICustomGlyphVectorShape } from 'customGlyphs/Types';
|
||||
|
||||
/**
|
||||
|
||||
@@ -849,6 +849,13 @@ function customGlyphRangesHandler(): void {
|
||||
['Block elements', 0x2594, 0x2595],
|
||||
['Terminal graphic characters', 0x2596, 0x259F],
|
||||
]);
|
||||
// Powerline Symbols
|
||||
// Range: E0A0–E0BF
|
||||
// https://github.com/ryanoasis/nerd-fonts
|
||||
writeUnicodeTable(term, 'Powerline Symbols', 0xE0A0, 0xE0BF, [
|
||||
['Powerline Symbols', 0xE0A0, 0xE0B3],
|
||||
['Powerline Extra Symbols', 0xE0B4, 0xE0BF],
|
||||
]);
|
||||
// Symbols for Legacy Computing
|
||||
// Range: 1FB00–1FBFF
|
||||
// https://www.unicode.org/charts/PDF/U1FB00.pdf
|
||||
|
||||
@@ -71,7 +71,8 @@ export function writeUnicodeTable(term: Terminal, name: string, start: number, e
|
||||
// If labels exist and don't start at column 0, first output chars before first label
|
||||
if (rowLabels.length > 0 && rowLabels[0].col > 0) {
|
||||
const rowHex = row.toString(16).toUpperCase();
|
||||
term.write(bold('U+' + rowHex + 'x '));
|
||||
const rowPrefix = `U+${rowHex}x`.padEnd(8, ' ');
|
||||
term.write(bold(rowPrefix));
|
||||
for (let col = 0; col < rowLabels[0].col; col++) {
|
||||
const codePoint = row * 16 + col;
|
||||
term.write(' ');
|
||||
@@ -93,7 +94,7 @@ export function writeUnicodeTable(term: Terminal, name: string, start: number, e
|
||||
if (rowLabels.length > 0) {
|
||||
// Render label lines from top to bottom (first label on top, last label closest to row)
|
||||
for (let i = 0; i < rowLabels.length; i++) {
|
||||
const prefix = ' '; // Same width as "U+1FB0x "
|
||||
const prefix = ' '.repeat(8); // Same width as "U+1FB0x "
|
||||
let line = '';
|
||||
let visualLen = 0; // Track visual length separately from string length (escape codes don't count)
|
||||
for (let col = 0; col < 16; col++) {
|
||||
@@ -117,7 +118,7 @@ export function writeUnicodeTable(term: Terminal, name: string, start: number, e
|
||||
|
||||
// Row prefix (e.g., "U+1FB0x ")
|
||||
const rowHex = row.toString(16).toUpperCase();
|
||||
const rowPrefix = 'U+' + rowHex + 'x ';
|
||||
const rowPrefix = `U+${rowHex}x`.padEnd(8, ' ');
|
||||
const isSecondPrint = rowLabels.length > 0 && rowLabels[0].col > 0;
|
||||
term.write(isSecondPrint ? ' '.repeat(rowPrefix.length) : bold(rowPrefix));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user