fix(structure): inherit row emphasis propagation and deleted-row tint from DataGridRowView#1181
Closed
fix(structure): inherit row emphasis propagation and deleted-row tint from DataGridRowView#1181
Conversation
Member
Author
|
Rolling into a larger Structure-tab fix bundle that also adds applyVisualState wiring, reloadVersion observation, Add Row routing, Cmd+Z/Edit menu undo, and dead-code cleanup. New PR coming. |
12 tasks
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
Structure tab's
StructureRowViewWithMenunow subclassesDataGridRowViewinstead ofNSTableRowViewso it inherits the emphasis-propagation logic that PR #1135 added for data-tab rows.Before
Selecting a row in the Structure tab tinted the focused cell's text correctly (the cell that AppKit invalidated to draw the focus ring), but the other cells in the same row stayed at their unselected text color. The user reported "the active row it correct text color on focus cell, other cell is wrong color, also other issues."
Root cause
DataGridCellView(the direct-drawNSViewcell from PR #1135) readsisSelected && isEmphasizedfrom its enclosing row view inviewWillDrawto pickalternateSelectedControlTextColorvs the regular text color. But it only redraws whenneedsDisplayis set on it. AppKit doesn't invalidate sibling cells when the row's selected/emphasized state changes — that propagation is the row view's job.DataGridRowViewalready does this:StructureRowViewWithMenu: NSTableRowViewhad no such overrides, so structure-tab cells stuck on their unselected color until something else invalidated them.Fix
DataGridRowViewdropsfinalto allow subclassing.StructureRowViewWithMenunow extendsDataGridRowView. It removes the duplicatedcoordinatorandrowIndexproperties (inherited from the parent) and routes its existingisRowDeletedflag throughapplyVisualState(_:)so deleted rows pick up the same red tint the data tab uses.Side benefits: structure rows also gain the layer-backing setup (
wantsLayer,canDrawSubviewsIntoLayer, disabled implicit layer animations) that PR #1135 added for scroll perf, and the deleted-row tint that previously was tracked but never drawn in the structure tab.Test plan
CreateTableView(which uses the same row view).