fix: align data grid header padding#1040
Conversation
34d657e to
636e8ec
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a visual inconsistency in the Results data grid by ensuring table column headers use the same horizontal padding as result cells, and by rendering the row-number # header using the same custom header cell path as other headers (including right alignment). It also adds targeted unit coverage for the header title inset logic.
Changes:
- Replace default unsorted header interior drawing with custom title drawing that applies consistent horizontal insets.
- Use
SortableHeaderCellfor the row-number (#) header and align it to the right to match row-number cells. - Add tests validating
SortableHeaderCell.titleRect(forBounds:)padding behavior and clamping for narrow widths.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| TableProTests/Views/Results/SortableHeaderCellTests.swift | Adds tests verifying header title rect padding and non-negative width behavior. |
| TablePro/Views/Results/SortableHeaderCell.swift | Implements padded titleRect(forBounds:) and unifies title drawing for sorted/unsorted headers. |
| TablePro/Views/Results/DataGridView.swift | Switches the row-number column header to use SortableHeaderCell with right alignment. |
| CHANGELOG.md | Documents the header padding fix in the “Fixed” section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
#header with the same header cell and right alignment as row-number cells.SortableHeaderCell.titleRect(forBounds:).before
after
Root Cause
Data cells applied 4pt leading and trailing constraints, but unsorted headers used the default
NSTableHeaderCellinterior drawing. That left header titles flush against grid edges, and the row-number header used a different cell path from the row-number content cells.Validation
xcodebuild -project TablePro.xcodeproj -scheme TablePro test -skipPackagePluginValidation -only-testing:TableProTests/SortableHeaderCellTests CODE_SIGNING_ALLOWED=NOswiftlint lint --strict --config .swiftlint.ymlusing the SwiftLint plugin binaryxcodebuild -project TablePro.xcodeproj -scheme TablePro -configuration Debug build -skipPackagePluginValidation CODE_SIGNING_ALLOWED=NO