Skip to content

A box round a picture fits it in a terminal too - #51

Merged
HarryCordewener merged 1 commit into
mainfrom
claude/scene-recall-unboxed-70cl4k
Oct 8, 2026
Merged

HarryCordewener merged 1 commit into
mainfrom
claude/scene-recall-unboxed-70cl4k

Conversation

@HarryCordewener

@HarryCordewener HarryCordewener commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Requested by Grave · project thread

Before: in a terminal that draws pictures (Kitty, iTerm2, sixel, block art), box(figure(...)) was drawn across the whole width with the picture in its left corner, so the box stood wider than the rules and lines around it. The portal already fit the box to the picture (#47).

After: a Frame whose body is only an unfloated Figure, laid out for a reader shown the picture, has no padding and is as wide as the picture, or its title when that is wider. A reader shown the art or the description still gets the box across the width.

How: Figure.PictureWidth answers how many cells the picture takes for this reader (the same decision Draw makes), and Frame.Draw narrows itself to that. Tests cover the fitted box, a title wider than the picture, and a reader not shown the picture.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DLuNT88dr1ZgRLtgLnCHwr


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed frame sizing for standalone pictures: frames now fit the picture or its title without extra padding.
    • Frames retain their full configured width when the picture isn’t displayed or when the figure shows art or a description instead.

A Frame whose body is only an unfloated Figure, laid out for a reader shown
the picture, drops its padding and is as wide as the picture or its title,
matching the HTML ms-box-picture. It was drawn across the whole width with
the picture in its left corner.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DLuNT88dr1ZgRLtgLnCHwr
@HarryCordewener HarryCordewener self-assigned this Oct 8, 2026
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 4de746bb-de53-4c73-9604-e8867893b4bc
📥 Commits

Reviewing files that changed from the base of the PR and between 51d3c51 and 79f0972.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • MarkupString.Tests/Ansi/TerminalFeatureTests.cs
  • MarkupString/Layout/Blocks/Figure.cs
  • MarkupString/Layout/Blocks/Frame.cs

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Your free on-demand review promotion remains active until October 9, 2026 at 6:00 PM UTC.


Walkthrough

Standalone pictures in frames now use a width based on the picture or title when picture dimensions are available. Other figure content and unavailable pictures retain the configured frame width.

Changes

Standalone picture frame sizing

Layer / File(s) Summary
Determine picture width
MarkupString/Layout/Blocks/Figure.cs
Figure.Draw now uses normalized art lines. PictureWidth returns a width when the image source, picture handler, and reported dimensions are valid.
Size the frame and validate the behavior
MarkupString/Layout/Blocks/Frame.cs, MarkupString.Tests/Ansi/TerminalFeatureTests.cs, CHANGELOG.md
For an un-floated figure with no Beside content and a known picture width, Frame.Draw removes padding and sizes the frame to the wider of the picture or title, capped by available width. Tests cover untitled, titled, and unavailable-picture cases.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: claude

Merge Risk: ⚪ Minimal · up to 79f09

The supplied evidence identifies no issue that needs resolution before merging. Runtime behavior remains untested in the supplied review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fitting a box around a picture in terminal readers.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. (1 skipped: 1 u…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@HarryCordewener
HarryCordewener merged commit 62345a3 into main Oct 8, 2026
7 checks passed
@HarryCordewener
HarryCordewener deleted the claude/scene-recall-unboxed-70cl4k branch October 8, 2026 01:56
HarryCordewener added a commit that referenced this pull request Oct 8, 2026
2.14.2 (#51) fitted a box holding only a picture to the picture. In a scene
log that box stood narrower than every other pose's box and rule. It is drawn
across the width again, with its padding, and the picture at its left. HTML
keeps fitting it (ms-box-picture).

This reverts the Frame and Figure parts of 62345a3.


Claude-Session: https://claude.ai/code/session_018ztDNVgzxM8V5WKWBRs2EW

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants