Add TODOs from jerch's comments

This commit is contained in:
Anthony Kim
2026-01-28 09:17:44 -08:00
parent a1b69e5ac8
commit 492d950b64
2 changed files with 8 additions and 0 deletions
@@ -537,6 +537,9 @@ export class KittyApcHandler {
}
if (format === KittyFormat.PNG) {
// TODO: Older Safari versions cannot createImageBitmap from Blob and need a workaround
// with new Image() instead. See IIPHandler for the Safari fallback pattern.
// ---> Things seem to work for my safari, but still try to see how I can verify.
const blob = new Blob([bytes], { type: 'image/png' });
return createImageBitmap(blob);
}
@@ -557,6 +560,7 @@ export class KittyApcHandler {
// Convert to RGBA ImageData
// TODO: Get this checked by Daniel.
// TODO: Follow Jerch's feedback!
const pixelCount = width * height;
const data = new Uint8ClampedArray(pixelCount * BYTES_PER_PIXEL_RGBA);
const isRgba = format === KittyFormat.RGBA;
@@ -44,6 +44,10 @@ export class KittyGraphicsAddon implements ITerminalAddon, IKittyGraphicsApi {
// Register APC handler for 'G' (0x47) - Kitty graphics protocol
// APC sequence format: ESC _ G <data> ESC \
// TODO: Follow jerch's feedback: The string-based handler interface is limited to 10MB
// and has bad runtime due to string conversion overhead. Implement IApcHandler interface with
// start/put/end methods to receive raw Uint32Array codepoints without copying.
// See SixelHandler and IIPHandler.
this._apcHandler = terminal.parser.registerApcHandler(0x47, (data: string) => {
return this._kittyApcHandler?.handle(data) ?? true;
});