Skip to content

fix: let Go-to's g i resume writing in the field its stance just shut - #6514

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-6513
Nov 19, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-6513

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

g i (Go-to, then Resume writing) raised "That writing place is unavailable" even though the field then got focus and its draft. #6461 made a stance shut the panel's field, and the field's closed read the stance from the repaint frame's copy (statusContextReading().stance). The Go-to destination ends the stance and runs writing.resume in the same task, before that frame. So resumeAt saw the field's painted readOnly still set and raised the error.

The field's closed now reads the stance from the dispatcher (stanceWords(innermostStance()?.scope)), the same thing paintStatusContext computes. The row's words (still) and the writing posture keep the frame's copy, so #6461's decision that the field and the row's ✕ change in the same paint still holds for what is painted. resumeAt now asks takesNoWords(field) instead of the painted readOnly. That also covers any other Go-to destination that writes into the field in the same task.

One behavior moves beyond the failing case. readOnly is also set while an image uploads, so Resume writing used to refuse a box with an upload in flight. It now moves the caret there. takesNoWords's own comment already says that box stays one c may move to.

test_writing_reaches_the_field_however_the_panel_stands fails on main (2cd1bda49) with the error's count at 1 and passes on this branch. The panel tests matching stance, mode, Escape, resume and writing pass, and so do pnpm run test:runtime and pnpm run check:browser.

Closes #6513 — automated triage

Since #6461 a stance shuts the panel's field, and the field's `closed` read
the stance from the repaint frame's copy (status-context.js). `g i` ends the
Go-to stance and runs Resume writing in the same task, so `resumeAt` found
the field still painted read-only and raised "That writing place is
unavailable", though it then got focus and its draft.

The field's `closed` now reads the stance from the dispatcher, as the repaint
frame computes it, while the row's words (`still`) and the writing posture
keep the frame's copy. `resumeAt` asks `takesNoWords` rather than the painted
`readOnly`. Behavior change: Resume writing now reaches a box whose image is
still uploading, which `readOnly` alone had refused.

test_writing_reaches_the_field_however_the_panel_stands fails on main and
passes with this change.

Closes #6513
@max-sixty
max-sixty merged commit dd38dcb into main Nov 19, 2026
6 checks passed
@max-sixty
max-sixty deleted the fix/issue-6513 branch November 19, 2026 12:00
max-sixty added a commit that referenced this pull request Nov 23, 2026
… composing/input.js (#6907)

The knip pre-commit hook printed import cycles and still passed, because
knip grades `cycles` a warning by default and a warning doesn't set the
exit code. So the cycle `browser/runtime/drafts.js` ↔
`browser/runtime/composing/input.js`, added in #6514, has stood on main
with CI green. `.config/knip.js` now sets `rules: { cycles: "error" }`,
which makes the hook do what its header and `browser/AGENTS.md`
("Runtime ownership") already said it did.

The fix keeps `input.js` → `drafts.js` (the box wiring is a view of the
draft store) and drops `drafts.js` → `input.js`. Resume writing needed
`takesNoWords` to ask whether the box it reaches takes words now.
Instead, a draft subscription now carries that answer (`closed`, default
false), `mirrorDraft` passes the wiring's own `sync.closed`, and
`resumeAt` asks the editor it found. The only boxes that supply
`closed`, the floating panel's field and its thread replies, both
register through `mirrorDraft`, so Resume writing answers as before.

To weigh: `watchDraft` is in the public widget API, so it gains an
undocumented `closed` option, like its existing `resume` and `mirrored`.

Checks: knip exits 0 on this branch and 1 with the import restored;
dependency-cruiser, `pnpm run check:browser`, and the runtime tests for
drafts, composing-input, message-edit, words-watch and
annotation-inventory pass; a `leaf-dev probe` journey resumes a page
draft and a closed thread's reply through `g i`.

Found while porting deslop-please's lints to Leaf.

> _This was written by Claude Code on behalf of max-sixty_
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.

test_writing_reaches_the_field_however_the_panel_stands: g i resumes writing while Go-to's stance still shuts the field

2 participants