mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Use sharding, decode with streaming
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -93,13 +93,19 @@ export interface IKittyCommand {
|
||||
|
||||
/**
|
||||
* Pending chunked transmission state.
|
||||
* Stores metadata from the first chunk while accumulating payload data.
|
||||
* Stores metadata from the first chunk while accumulating decoded payload data.
|
||||
*/
|
||||
export interface IPendingTransmission {
|
||||
/** The parsed command from the first chunk (contains action, format, dimensions, etc.) */
|
||||
cmd: IKittyCommand;
|
||||
/** Accumulated base64 payload data */
|
||||
data: string;
|
||||
/** Accumulated decoded payload chunks */
|
||||
chunks: Uint8Array[];
|
||||
/** Total size of accumulated chunks */
|
||||
totalSize: number;
|
||||
/** Leftover base64 bytes (0-3) that weren't aligned in previous chunk */
|
||||
leftover: Uint32Array;
|
||||
/** Number of valid bytes in leftover */
|
||||
leftoverLength: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +113,8 @@ export interface IPendingTransmission {
|
||||
*/
|
||||
export interface IKittyImageData {
|
||||
id: number;
|
||||
data: string;
|
||||
/** Decoded image bytes (already decoded from base64) */
|
||||
data: Uint8Array;
|
||||
width: number;
|
||||
height: number;
|
||||
format: 24 | 32 | 100;
|
||||
|
||||
@@ -77,6 +77,7 @@ const TESTDATA_IIP: [string, [number, number]][] = [
|
||||
|
||||
// Kitty graphics test images
|
||||
const KITTY_BLACK_1X1_BASE64 = readFileSync('./addons/addon-image/fixture/kitty/black-1x1.png').toString('base64');
|
||||
const KITTY_BLACK_1X1_BYTES = Array.from(readFileSync('./addons/addon-image/fixture/kitty/black-1x1.png'));
|
||||
const KITTY_RGB_3X1_BASE64 = readFileSync('./addons/addon-image/fixture/kitty/rgb-3x1.png').toString('base64');
|
||||
|
||||
let ctx: ITestContext;
|
||||
@@ -386,8 +387,8 @@ test.describe('ImageAddon', () => {
|
||||
await ctx.proxy.write(`\x1b_Ga=t,f=100,i=99;${part2}\x1b\\`);
|
||||
await timeout(100);
|
||||
|
||||
const storedData = await ctx.page.evaluate(`window.imageAddon._handlers.get('kitty').images.get(99).data`);
|
||||
strictEqual(storedData, KITTY_BLACK_1X1_BASE64);
|
||||
const storedData = await ctx.page.evaluate(`Array.from(window.imageAddon._handlers.get('kitty').images.get(99).data)`);
|
||||
deepStrictEqual(storedData, KITTY_BLACK_1X1_BYTES);
|
||||
});
|
||||
|
||||
test('delete command (a=d) removes specific image by id', async () => {
|
||||
|
||||
Reference in New Issue
Block a user