Skip to content

Fix Table View first subthought overlapping parent when applied to the root context#4548

Draft
BayuAri with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-subthought-overlapping
Draft

Fix Table View first subthought overlapping parent when applied to the root context#4548
BayuAri with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-subthought-overlapping

Conversation

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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

toggleTableView sets =view/Table on rootedParentOf(cursor), which for a top-level thought is the root (HOME_TOKEN). linearizeTree starts traversal at the root's children, so the root is never emitted as a node and never receives table metadata — tableCol1Widths gets no root entry. In usePositionedThoughts, the ancestorTableWidths reduce derives col2's x-offset from node.path[i - 2]; since the root appears in no Path, col2 resolves to offset 0 and lands on top of col1.

Changes

  • src/hooks/usePositionedThoughts.ts — treat the root as a virtual table ancestor:
    • Precompute the root col1 width from depth-0 isTableCol1 nodes and register it under HOME_TOKEN in tableCol1Widths.
    • Reduce ancestorTableWidths over [HOME_TOKEN, ...node.path] so col2 picks up the root's col1 width.
    • Add ?? HOME_TOKEN fallbacks in the indentCursorAncestorTables col2/col2Child lookups and the width field.
  • src/e2e/puppeteer/__tests__/table-view.ts — regression test pasting =view/Table at 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) is 0/unset unless the root itself is a table (no depth-0 isTableCol1 nodes otherwise), so prepending HOME_TOKEN contributes a 0 offset and leaves existing table layouts unchanged.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Vercel preview: https://em-oq2wzlibf-cybersemics.vercel.app

Copilot AI and others added 3 commits July 9, 2026 03:12
Co-authored-by: BayuAri <8419585+BayuAri@users.noreply.github.com>
)

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
Copilot AI requested a review from BayuAri July 9, 2026 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The subthought is overlapping with thought when user activates Table View from thought

2 participants