💡 translate: shift an element's paint without affecting flow

Open
#82 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
c, typescript
Domain
cli

Research direction

Start with the failing test in test/translate.test.ts, then read the layout definitions in ops.ts:97-120 and ops.ts:245-253, followed by layout-group decoding in src/clayterm.c:499-516. Verify that the translate is applied after flow layout, shifts painted descendants and reported bounds, preserves sibling placement, and changes the expected output from "AB " to " BA ".

Written by the indexing model from the issue text.

Description

enhancement

Is your feature request related to a problem?

There's no way to nudge an element a few cells from where layout placed it while leaving its neighbors put. The only offset tool today is floating, which pulls the element out of flow so siblings reflow to fill the gap. A fixed(5) row holding element a (text A) followed by text B renders "AB "; we can't shift A two cells right while B stays put, since anything that moves A collapses B back to column 0. That rules out small visual nudges (badges, carets, hover) that shouldn't disturb surrounding layout.

Describe the solution you'd like

A render-time translate that shifts an element's painted cells (and its descendants') by {x, y} after flow layout, mirroring the CSS translate property (exact name TBD). It does not change layout: the element keeps its computed flow slot and siblings don't move. It's purely a visual displacement, with the element's reported bounds following the shift so hit-testing stays correct. Above, a keeps its slot at x=0, B stays at column 1, and a paints two cells over to yield " BA ".

const node = open("a", {
  layout: {
    translate: { x: 2, y: 0 },
  },
});

Describe alternatives you've considered

floating removes the element from flow (siblings collapse), so it can't do an in-place nudge. Post-processing the rendered grid in TS can't see clip regions, backgrounds, or descendant bounds, and info.bounds would still report the un-shifted position—breaking hit-testing and hover. A renderer-side translate keeps bounds and paint in sync.

Additional context

Failing test case on nm/repro/translate (test · diff). Today bounds.x is 0 instead of 2 and the row renders "AB " instead of " BA ". This likely lives in ops.ts:97-120 (the pack layout group has no translate slot) and ops.ts:245-253 (OpenElement.layout has no translate field), with the render-time shift applied where the layout group is decoded (src/clayterm.c:499-516).

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bombshell-dev/tty

All issues in bombshell-dev/tty

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.