lipgloss
lipgloss copied to clipboard
Fix border width calculation in renderHorizontalEdge
Summary
- Fixes an off-by-one error in
renderHorizontalEdgethat 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:
- The right border width wasn't being properly subtracted when calculating the middle section
- 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
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.