Skip to content

✨ per-side border support#96

Open
rauhryan wants to merge 1 commit into
issue-68-border-bgfrom
per-side-border-69
Open

✨ per-side border support#96
rauhryan wants to merge 1 commit into
issue-68-border-bgfrom
per-side-border-69

Conversation

@rauhryan

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds per-side border support

Closes #

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • All tests pass (pnpm test)
  • Files are formatted (pnpm format)
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

expands per-side border attributes to allow for fg, width, bg properties
for each side of the border
@github-actions

Copy link
Copy Markdown

Size Increased — +0.8 KB

109.0 KB unpacked

@pkg-pr-new

pkg-pr-new Bot commented Jun 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/clayterm@96

commit: b54ecfa

@rauhryan

Copy link
Copy Markdown
Collaborator Author
image

@rauhryan rauhryan marked this pull request as ready for review June 10, 2026 17:10
@rauhryan rauhryan requested a review from cowboyd June 11, 2026 13:49

@dreyfus92 dreyfus92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall just left a comment 👀

Comment thread src/clayterm.c
Comment on lines +306 to +316
/* userData points at eight words in the command buffer carrying resolved
* per-side attributes as fg/bg pairs in top, right, bottom, left order.
* Fallback resolution (shared color/bg vs side overrides) happens on the
* TypeScript side; this renderer consumes explicit values only. The
* command buffer outlives the render pass within reduce(). */
const uint32_t *s = (const uint32_t *)cmd->userData;
uint32_t deffg = color(b->color);
uint32_t top_fg = s ? s[0] : deffg, top_bg = s ? s[1] : ATTR_DEFAULT;
uint32_t right_fg = s ? s[2] : deffg, right_bg = s ? s[3] : ATTR_DEFAULT;
uint32_t bot_fg = s ? s[4] : deffg, bot_bg = s ? s[5] : ATTR_DEFAULT;
uint32_t left_fg = s ? s[6] : deffg, left_bg = s ? s[7] : ATTR_DEFAULT;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if i'm understanding this correctly, deffg can't resolve to the shared color anymore, reduce() no longer sets decl.border.color, so b->color is always {0} and this fallback yields explicit black, not the shared fg, since the s===NULL branch is only reachable on a truncated buffer that validate would reject anyway, maybe just a fall back after to ATTR_DEFAULT here like the bg pairs do? as written it reads like the shared color still exists on the C side but it only lives in the ts resolution now 👀

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