fix(layout): correct straight-edge 1-char misalignment#10
Merged
cristipufu merged 4 commits intomainfrom Feb 9, 2026
Merged
Conversation
Round the desired center to an integer first, then subtract w // 2, to match how Box.cx computes the connector position (x + w // 2). The old int(desired - w/2) truncated toward zero, biasing odd-width boxes 1 char left of their parent's visual center. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0ca162a to
e2f6cad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
int(desired - w/2)withround(desired) - w // 2in all 3 coordinate assignment phases. Rounds the desired center to an integer first, then offsets byw // 2— matching howBox.cx(x + w // 2) computes the connector position. The oldint()truncation biased odd-width boxes 1 char left, causing visible misalignment in linear chains with mixed even/odd box widths.book-writer-agentsample (6-node linear chain that exposed the layout bug) and regenerate all screenshots.Test plan
uv run pytest tests/ -v— all 82 tests passuv run graphtty samples/book-writer-agent/graph.json—__end__edge centereduv run graphtty samples/function-agent/graph.json— no regressionuv run ruff format . && uv run ruff check --fix .— cleanuv run ty check— clean🤖 Generated with Claude Code