Skip to content

attach images to Markers #5870

@PerBothner

Description

@PerBothner

I believe there is agreement that the ExtendedAttrsImage mechanism for attaching images to buffers is problematic. I also believe PR #5853 provides a reasonable solution. I can't say I have a solid understanding of the image addon, but I have some preliminary ideas.

PR #5853 extends a Marker with a payload field. We can use this to link from a Marker to image-related information. Perhas an IImageSpec directly. The loop in ImageStorage.render could be something like:

for (let row = start; row <= end; ++row) {
  const line = buffer.lines.get(row + buffer.ydisp) as IBufferLine;
  if (!line) return;
  if (line.isWrapped && row !== start) { continue; } // already handled
  line.logicalLine.forEachMarker((marker) => {
    if (marker.payload instanceof IImageSpec) {
      drawCalls.push({ imgSpec: marker.payload, ...});
    }
  });
 ...
}

This way we can get rid all the IExtendedAttrsImage complication.
There are probably some minor complications with images that span multiple lines.
@jerch - what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions