Skip to content

fix: elements at fractional positions drawing on the wrong cells - #168

Open
dreyfus92 wants to merge 4 commits into
mainfrom
fix/fractional-cell-coverage
Open

dreyfus92 wants to merge 4 commits into
mainfrom
fix/fractional-cell-coverage

Conversation

@dreyfus92

@dreyfus92 dreyfus92 commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

render coordinates used (int) casts, which truncate toward zero, so anything between y = -1 and 0 drew on row 0 (a panel sliding in from above stacked its rows there). now edges round with ceilf(v - 0.5) to the cell whose center they cover

the hit test needed one more piece to agree with that: clay's Clay__PointIsInsideRect includes both edges, so when an edge lands exactly on a cell center both elements get the pointer. this happens on plain odd grow() splits too (two siblings in 41 columns are 20.5 wide). patches/clay-half-open-hit-test.patch makes the bottom and right edges exclusive

added renderer-spec §7.11 (cell coverage) and pointed §12.4 at it. test/coverage.test.ts sweeps a panel from y = -3 to 1 and checks the pointer hits exactly the row drawn in every cell

heads up: fractional edges past the middle of a cell now round up instead of down, a 3-way split of 40 columns starts the third element at 27 instead of 26. no existing test changed

closes #151

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

@bombshell-cooper

Copy link
Copy Markdown
Contributor

Changeset suggestion

The current changeset no longer matches this PR. This review contains a corrected replacement.

Why: Changeset package scope does not match the affected packages confidently. Changeset is not sufficiently consumer-focused.

View the proposed changeset
---
'@bomb.sh/tty': patch
---

TODO: Write changeset message (inference failed: HTTP 401: {"error":{"message":"User not found.","code":401}})

Review this changeset manually

If this draft is correct, react with 🚀 and Cooper will commit it to this branch.

@@ -0,0 +1,5 @@
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changeset needs revision.

Changeset package scope does not match the affected packages confidently. Changeset is not sufficiently consumer-focused.

View the proposed replacement
---
'@bomb.sh/tty': patch
---

TODO: Write changeset message (inference failed: HTTP 401: {"error":{"message":"User not found.","code":401}})

@pkg-pr-new

pkg-pr-new Bot commented Oct 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@bomb.sh/tty@168

commit: 307b7d0

@github-actions

Copy link
Copy Markdown

Size Reduced — -0.1 KB

129.3 KB unpacked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 elements at a negative fractional y draw on row 0 instead of being clipped

1 participant