feat(ui): show inline images in the Details pane #71
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Images in PR and issue bodies can't be seen. With #65 (fetch and decode) and #66 (kitty graphics layer and detection) merged, the Details pane can now draw them inline. Part 3 of #60.
Acceptance criteria
Sources: the PM's answers on #60 unless noted.
allow-passthroughon) an image that stands alone in a paragraph of a PR or issue body renders inline in the scrolling Details body, and scrolls and clips with the text. (PM: inline in the scrolling body)🖼 altlink. (PM answer 1)🖼 altlink everywhere. (PM answer 4)allow-passthrough, a loading image and a failed image all show the🖼 altlink, silently: no error message. (PM answers 3, 5, 6)<img>(such as Renovate badges) keep the🖼 altlink.docs/design.mdrecords these behaviors;docs/adr/0014Consequences notes images now render in supported terminals.Plan
Decided by Opus (design on #60, ADR 0016 from #65,
internal/ui/termimgfrom #66):markdown.Images(body) []stringlists block images (a paragraph whose only content is images, optionally wrapped in a link);markdown.RenderWithImages(body, width, blocks map[string][]string)splices prepared lines in.Render(body, width)is the same call with nil, so the markdown package stays pure and knows nothing about kitty.detailskeeps per-URL state (loading, ready(id, cols, rows), failed). On sync it issues a load command (core.Service.Image) per unknown block image;imageLoadedMsgleads totea.Sequence(tea.Raw(termimg.Transmit(...)), placedMsg); onlyplacedMsgbumps animgGencounter that is part of themdMemokey. Resize recomputes cols and rows and sendsPlace. Session close and the toggle going off sendDeletefor every held ID.termimg.IDsallocates IDs;Supportfrom #66 gates everything.Context
forge.AssetReader,core.Service.Image/PeekImage((image.Image, bool, error)), the 16-entry LRU (cleared byr). #66 deliveredtermimgandDeps.Detect/App.support.internal/ui/details.gorenders via a one-entrymdMemo; image lines must flow through the same memo.Out of scope
HTML
<img>, WebP, external hosts, other terminals.Refs #60
🤖 Planning #71 turned up three places where the acceptance criteria could be read two ways. I'm going with these readings unless you say otherwise:
🖼 altlink, because the drawn image is pane-wide and would overflow the indent.Also: HTML
<img>tags (such as Renovate badges) render nothing today, so they stay as they are rather than gaining a link.🤖 merged: #78