💡 Signed margin: offset a box without consuming content width
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- c, typescript
- Domain
- cli
Research direction
Start with test/signed-margin.test.ts and the repro diff, then read the padding packing in ops.ts and the layout decode around src/clayterm.c:499. Trace how Clay_LayoutConfig and the existing clip path handle box geometry. Done means signed positive and negative margins preserve content width, offset the box, clip leading overflow, and pass the signed-margin test.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem?
There's no way to offset a box's position within its parent's flow. The only per-side knob is layout.padding, which shrinks the content box instead of moving the box: "Hello W" (7 cells) fits on one line in a fixed(8) box, but padding: { left: 2 } drops content to 6 cells and wraps to two lines. Padding also can't be negative—each side is an unsigned byte, so padding: { left: -3 } wraps to garbage (the box returns height: 511). There's no primitive for placing a box before its parent's content origin and clipping the overflow.
Describe the solution you'd like
A signed layout.margin that moves a box without shrinking its content, mirroring the CSS margin property: it sits outside the content box and may be negative. margin: { left: 2 } keeps the box's width and stays on one line; a negative left margin places the origin before the parent's content origin, so with the parent clipping, the leading cells are suppressed and the rest renders flush to the edge.
open("box", {
layout: { width: fixed(12), margin: { left: -3 } },
});
Describe alternatives you've considered
padding as a stand-in fails both ways: it shrinks content and corrupts geometry on negative input (unsigned packing). Pre-clipping strings in JS can't reflow or re-clip on resize and doesn't generalize to nested boxes.
Additional context
Failing test case on nm/repro/signed-margin (test · diff). margin needs its own signed word (the ops.ts padding packing is 4×uint8 and can't be reused) and a post-layout offset step in the layout decode (src/clayterm.c:499); Clay_LayoutConfig has no margin, so it's a new primitive on top of Clay that leans on the existing clip path.
- Dominant language
- TypeScript
- Stars
- 42
- Forks
- 2
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 12
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bombshell-dev/tty
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bombshell-dev/tty#61 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
bombshell-dev/tty#129 ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 38/100
bombshell-dev/tty#112 ·
-
enhancement high priority
Difficulty 3/5 1-2 days Newbie friendliness 68/100
bombshell-dev/tty#83 · 2 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
bombshell-dev/tty#82 ·
All issues in bombshell-dev/tty
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug v2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/inspector#2458 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
carbon-design-system/ibm-products#9907 ·