Skip to content

Change image storage to use new ExtendedAttrs payload field#5879

Open
PerBothner wants to merge 1 commit into
xtermjs:masterfrom
PerBothner:image-ext
Open

Change image storage to use new ExtendedAttrs payload field#5879
PerBothner wants to merge 1 commit into
xtermjs:masterfrom
PerBothner:image-ext

Conversation

@PerBothner
Copy link
Copy Markdown
Contributor

Adds a general-purpose payload hook to ExtendedAttrs. This allows us to get rid of the ExtendedAttrsImage logic, which can easily conflict with other extensions.

The PR avoids looking into BufferLine internals by instead using loadCell and setCell. The calls to loadCell may add slightly more overhead; if that is measurable, we can look into reducing the number of loadCell calls.

This is an implementation of this suggestion.

It might make sense for a future update to remove the urlId field from ExtendedAttrs and instead use the general payload hook.

@PerBothner
Copy link
Copy Markdown
Contributor Author

An optional optimization is to replace imageId (which needs to be looked up in the _images map) with a direct reference to IImageSpec:

class ImageTileInfo {
  constructor(
    public imageSpec: IImageSpec | undefined = undefined,
    public tileId = -1) {
  }
}

A further possibility would be to remove the _images map. Since each IImageSpec has an associated Marker, when we need to iterate over all images, we can do that by iterating over markers. This assumes we add a payload field to Marker (as suggested in PR #5853), and that the payload field is used to point back to the IImageSpec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant