Conversation
… grid horizontal inset
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Follow-up refactor to #1040. Two correctness wins and one cleanup.
1.
titleRect(forBounds:)now returns the same rect AppKit and AX seeAfter #1040,
drawInteriorwas passing an indicator-subtracted sub-rect intotitleRect(forBounds:). AppKit and AX callcell.titleRect(forBounds: cellFrame)with full cell bounds, so external callers were getting back a frame that overlapped the sort indicator and priority badge.Moved the indicator/priority width math into a private
reservedTrailingWidth()helper thattitleRect(forBounds:)consults.drawInteriornow callstitleRect(forBounds: cellFrame)exactly once on the full bounds, and AX hit-testing lines up with what is actually drawn.2. Row-number column header right-alignment is now testable
Extracted
DataGridView.makeRowNumberColumn()as a static@MainActorfactory so the row-number column setup can be exercised from tests. AddedDataGridRowNumberColumnTests.rowNumberHeaderIsRightAlignedSortableCellso a future drive-by edit cannot silently drop.alignment = .righton the#header.3. Shared
DataGridMetrics.cellHorizontalInsetThe 4pt inset that ties data cells and column headers together was duplicated as literals across 5 files. Pulled into a single
DataGridMetrics.cellHorizontalInsetconstant (newCells/DataGridMetrics.swift).SortableHeaderCell,DataGridBaseCellView,DataGridCellRegistry,DataGridChevronCellView,DataGridForeignKeyCellViewall read from it. The two values can no longer drift.Tests
SortableHeaderCellTests.sortedTitleRectReservesTrailingSpaceForIndicator— sorted rect is narrower than unsorted at the same bounds, and itsmaxXdoes not run past the trailing inset.SortableHeaderCellTests.priorityBadgeShrinksSortedTitleRectFurther— priority >= 2 shrinks the rect further, matching what is reserved for the badge.DataGridRowNumberColumnTests.rowNumberHeaderIsRightAlignedSortableCell—#header is aSortableHeaderCellwith.rightalignment.titleRectUsesDataCellHorizontalPaddingandnarrowTitleRectDoesNotProduceNegativeWidthstill pass against the newtitleRect.Validation
swiftlint lint --strict --config .swiftlint.ymlclean across all eight changed files.xcodebuild ... test -only-testing:TableProTests/SortableHeaderCellTestsand-only-testing:TableProTests/DataGridRowNumberColumnTeststo verify (run locally).CHANGELOG
No entry. The AX semantic issue this fixes was introduced in #1040, which has not shipped, and project rules say not to add a Fixed entry for fixing something that is itself still unreleased.
Related