Skip to content

Conversation

@akaoio
Copy link

@akaoio akaoio commented Aug 23, 2025

Summary

  • Fixes an off-by-one error in renderHorizontalEdge that caused borders to render with incorrect width
  • Ensures right border width is properly accounted for in total width calculation
  • Corrects the loop logic to fill exactly the required middle section width

Problem

The renderHorizontalEdge function had a bug where:

  1. The right border width wasn't being properly subtracted when calculating the middle section
  2. The loop iteration logic could cause borders to overflow or underflow their intended width

This was particularly noticeable with wider borders or specific width values.

Solution

  • Calculate middle width as width - leftWidth - rightWidth
  • Fix the loop to iterate exactly over the middle width
  • Add width accounting for right borders in applyBorder
  • Add comprehensive tests to verify correct border rendering at various widths

Test Plan

✅ Added TestRenderHorizontalEdgeFix with multiple test cases
✅ All existing tests pass
✅ Verified borders render at exact specified widths

🤖 Generated with Claude Code

The renderHorizontalEdge function had an off-by-one error that caused
borders to be rendered with incorrect width. This fix:

1. Properly calculates the middle section width by subtracting both
   left and right widths from the total width
2. Fixes the loop logic to fill exactly the required middle width
3. Adds comprehensive tests to verify correct border rendering

This resolves issues where borders would overflow or underflow their
intended width, particularly noticeable with wider borders.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@meowgorithm
Copy link
Member

Thanks for this. In order for us to verify the issue, can you put together some sample code to verify the issue exists? This will greatly help us expedite our ability to review the PR.

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