Draft
Fix Table View first subthought overlapping parent when applied to the root context#4548
Conversation
Contributor
|
|
Co-authored-by: BayuAri <8419585+BayuAri@users.noreply.github.com>
…w) (#3568) Co-authored-by: BayuAri <8419585+BayuAri@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix subthought overlapping in table view
Fix Table View first subthought overlapping parent when applied to the root context
Jul 9, 2026
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.
Activating Table View while the cursor is on a top-level thought caused the first subthought to overlap its parent instead of forming a proper second column. Subsequent subthoughts rendered correctly, isolating the bug to the root context.
Root cause
toggleTableViewsets=view/TableonrootedParentOf(cursor), which for a top-level thought is the root (HOME_TOKEN).linearizeTreestarts traversal at the root's children, so the root is never emitted as a node and never receives table metadata —tableCol1Widthsgets no root entry. InusePositionedThoughts, theancestorTableWidthsreduce derives col2's x-offset fromnode.path[i - 2]; since the root appears in noPath, col2 resolves to offset0and lands on top of col1.Changes
src/hooks/usePositionedThoughts.ts— treat the root as a virtual table ancestor:isTableCol1nodes and register it underHOME_TOKENintableCol1Widths.ancestorTableWidthsover[HOME_TOKEN, ...node.path]so col2 picks up the root's col1 width.?? HOME_TOKENfallbacks in theindentCursorAncestorTablescol2/col2Child lookups and thewidthfield.src/e2e/puppeteer/__tests__/table-view.ts— regression test pasting=view/Tableat root and asserting the first subthought is offset right of the parent (subthought.x >= parent.x + parent.width).Safety for non-root tables
tableCol1Widths.get(HOME_TOKEN)is0/unset unless the root itself is a table (no depth-0isTableCol1nodes otherwise), so prependingHOME_TOKENcontributes a0offset and leaves existing table layouts unchanged.