fix(tui): prevent image ID collisions between modules

- allocateImageId() now returns random IDs instead of sequential
- Static images no longer auto-allocate IDs (transient display)
- Only explicit imageId usage (like DOSBox) gets tracked IDs
- Suppress emulators exit logging in DOSBox dispose

Fixes image replacement bug when extension and main app both
allocated sequential IDs starting at 1.
This commit is contained in:
Mario Zechner 2026-01-22 04:52:55 +01:00
parent df1d5c40ea
commit fbd6b7f9ba
3 changed files with 26 additions and 22 deletions

View file

@ -1,5 +1,4 @@
import {
deleteKittyImage,
getCapabilities,
getImageDimensions,
type ImageDimensions,
@ -102,15 +101,4 @@ export class Image implements Component {
return lines;
}
/**
* Delete the terminal image. Call this when done with the image
* to free terminal resources.
*/
dispose(): void {
if (this.imageId !== undefined) {
process.stdout.write(deleteKittyImage(this.imageId));
this.imageId = undefined;
}
}
}