mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Add CJK with random SGR test button
This is good as a stress test for the renderer
This commit is contained in:
@@ -220,6 +220,7 @@ if (document.location.pathname === '/test') {
|
||||
document.getElementById('custom-glyph').addEventListener('click', writeCustomGlyphHandler);
|
||||
document.getElementById('load-test').addEventListener('click', loadTest);
|
||||
document.getElementById('print-cjk').addEventListener('click', addCjk);
|
||||
document.getElementById('print-cjk-sgr').addEventListener('click', addCjkRandomSgr);
|
||||
document.getElementById('powerline-symbol-test').addEventListener('click', powerlineSymbolTest);
|
||||
document.getElementById('underline-test').addEventListener('click', underlineTest);
|
||||
document.getElementById('ansi-colors').addEventListener('click', ansiColorsTest);
|
||||
@@ -989,6 +990,25 @@ function addCjk(): void {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the 20977 characters from the CJK Unified Ideographs unicode block with randomized styles.
|
||||
*/
|
||||
function addCjkRandomSgr(): void {
|
||||
term.write('\n\n\r');
|
||||
for (let i = 0x4E00; i < 0x9FCC; i++) {
|
||||
term.write(`\x1b[${getRandomSgr()}m${String.fromCharCode(i)}\x1b[0m`);
|
||||
}
|
||||
}
|
||||
const randomSgrAttributes = [
|
||||
'1', '2', '3', '4', '5', '6', '7', '9',
|
||||
'21', '22', '23', '24', '25', '26', '27', '28', '29',
|
||||
'30', '31', '32', '33', '34', '35', '36', '37', '38', '39',
|
||||
'40', '41', '42', '43', '44', '45', '46', '47', '48', '49'
|
||||
];
|
||||
function getRandomSgr(): string {
|
||||
return randomSgrAttributes[Math.floor(Math.random() * randomSgrAttributes.length)];
|
||||
}
|
||||
|
||||
function addDecoration(): void {
|
||||
term.options['overviewRulerWidth'] = 15;
|
||||
const marker = term.registerMarker(1);
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
<dt>Performance</dt>
|
||||
<dd><button id="load-test" title="Write several MB of data to simulate a lot of data coming from the process">Load test</button></dd>
|
||||
<dd><button id="print-cjk" title="Prints the 20977 characters from the CJK Unified Ideographs unicode block">CJK Unified Ideographs</button></dd>
|
||||
<dd><button id="print-cjk-sgr" title="Prints the 20977 characters from the CJK Unified Ideographs unicode block with randomized SGR attributes">CJK Unified Ideographs (random SGR)</button></dd>
|
||||
|
||||
<dt>Styles</dt>
|
||||
<dd><button id="custom-glyph" title="Write custom box drawing and block element characters to the terminal">Test custom glyphs</button></dd>
|
||||
|
||||
Reference in New Issue
Block a user