Skip to content

Carry an open margin card's thread across a revision through the destinations - #3315

Merged
max-sixty merged 2 commits into
mainfrom
agent-a7bb90ff0c84ce7bd
Oct 20, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-a7bb90ff0c84ce7bd

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

When a revision moved an open margin card's passage into a closed tab, or hid it, the thread the user was reading left the page. #3305 left this case: it made openPageThread decide where every thread opens (the card beside a drawn passage, else the floating panel), but a card carried across a revision didn't go through it.

What happened before:

  • A revision installed in place kept the card. A card Leaf opened (openPageThread) stayed open and unseen, waiting for a passage nothing would draw again. One opened from its margin marker was closed by the next margin render, since its entry was no longer drawn.
  • A revision that loads a fresh document reopened the card with showPreview (margin-projection.js, restoreStanding). It never placed, and the next margin render closed it.

Both installations now capture the margin's and the panel's standing before the revision and restore it after (version.js; until now only the fresh document did). The margin restores an open card by opening its thread through openPageThread with scroll: false, so a revision the user didn't ask for opens no tab or disclosure over the passage. A user who stood in the card stands in the thread wherever it opens, and one on its Close button returns to Close when it reopens in the card.

  • A card the in-place revision kept, and that still has somewhere to stand (card.stands()), stays as it was, with its reading.
  • A card that accompanied the target the user stood on, with the user outside the card, comes back only beside that target's marker (openInlineThread, unfold: false), so it never takes the panel from a thread the user is reading there.
  • A reply the user is writing in the card is left to its editing continuity, which reopens the thread itself (and, as before, reveals the passage when the reply was in view).
  • Focus on a margin entry comes back whether or not a card was open too.
  • The panel's restore and the entry-focus restore change nothing where the in-place revision already kept that view or focus.

A card whose passage is hidden by anything else, such as a narrower window, still waits for it (#2650).

test_a_card_open_across_a_revision_opens_where_its_passage_stands covers both installations with the passage drawn and moved into a closed tab; the closed-tab cases fail without the change. Focused revision tests in test_revisions.py, test_render_anchors.py, test_render_aim.py, test_round_trip.py and two journeys/test_render_drafts.py cases pass, as does pnpm run test:runtime. Two independent Codex reviews found five issues in earlier versions (a stray panel beside a reply's own restore, an accompanying card taking the panel, focus lost to the body, focus in an entered accompanying card, entry focus skipped beside an open card); each is fixed here and confirmed by browser runs or a re-review.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 2 commits October 20, 2026 05:06
…inations

When a revision moved an open card's passage into a closed tab, or hid
it, the thread the user was reading left the page.

- A revision installed in place kept the card. A card opened by Leaf
  (`openPageThread`) stayed open and unseen, waiting for a passage
  nothing would draw again. One opened from its margin marker was closed
  by the next margin render, since its entry was no longer drawn.
- A revision that loads a fresh document reopened the card with
  `showPreview` (margin-projection.js, `restoreStanding`). It never
  placed, and the next margin render closed it.

Both installations now capture the margin's and the panel's standing
before the revision and restore it after (version.js; until now only
the fresh document did). The margin restores an open card by opening its
thread through `openPageThread`, where #3305 put the decision for every
opening: the card beside the passage where the passage is drawn, else
the floating panel. It passes `scroll: false`, so a revision the user
didn't ask for opens no tab or disclosure over the passage. A user who
stood in the card stands in the thread wherever it opens, and one on its
Close button returns to Close when it reopens in the card.

- A card the in-place revision kept, and that still has somewhere to
  stand (`card.stands()`), stays as it was, with its reading.
- A card that accompanied the target the user stood on, with the user
  outside the card, comes back only beside that target's marker,
  through the margin's accompaniment route (`openInlineThread`,
  `unfold: false`), so it never takes the panel from a thread the user
  is reading there.
- A reply the user is writing in the card is left to its editing
  continuity, which reopens the thread itself, so the card's standing
  doesn't also open it in the panel.
- Focus on a margin entry comes back whether or not a card was open
  too; before, an open card's restore returned before it.
- The panel's restore, and the margin's restore of focus on an entry,
  change nothing where the in-place revision already kept that view or
  focus.

A card whose passage is hidden by anything else, such as a narrower
window, still waits for it (#2650).

`test_a_card_open_across_a_revision_opens_where_its_passage_stands`
covers both installations with the passage drawn and moved into a
closed tab. The closed-tab cases fail without the change: no panel opens
and the card is closed or unseen. The drawn cases pass before and after.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit a305d63 into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the agent-a7bb90ff0c84ce7bd branch October 20, 2026 12:19
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.

2 participants