oficina / docs Public

web: after a resync the Format sheet keeps a selection only where its words are

Fable's follow-up A on #181. When a resync's relative positions resolve
to nothing (the refused change made the text), the old absolute
positions stood in, but the rebuilt document can hold a change the page
never saw (live updates are not taken while diverged), so they could
point at other words. Now the kept selection's words and its block's
words are recorded; the old positions stand in only where both still
read the same, else the block with the same words nearest the old place
is used, else the sheet closes (the editor asks phone.js to, with
docs:format-sheet-close) and the keyboard does not come back for it.
The selection is set with TextSelection.between (nit E).

TestAResyncAfterACollaboratorsChange lands a collaborator's change on
the server while holding the page's live fetch, then has a chip's save
refused (413): with a line above the selection (remote-before.bin) the
selection is kept over "Second paragraph."; with words written into it
(remote-edit-second.bin, new) the sheet closes. Before this, the first
drew the selection over "irst line." and the second over
"Edited: Second pa".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev af93afaa63c5741dc23dd40d00dcbe543d194177 parent 1d03856
6 files changed, +154 −35
  • fixtures/editor-entry.js +80 −23
  • fixtures/generate-fragment.mjs +6 −0
  • fixtures/vectors/fragment/remote-edit-second.bin binary
  • internal/docs/brand/phone.js +3 −0
  • internal/docs/phone_sheet_browser_test.go +51 −0
  • internal/docs/static/{editor.470aeecd64ebb8df.js => editor.4db3c5911184ef23.js} +14 −12
fixtures/editor-entry.js

Loading diff…

fixtures/generate-fragment.mjs

Loading diff…

fixtures/vectors/fragment/remote-edit-second.bin

Loading diff…

internal/docs/brand/phone.js

Loading diff…

internal/docs/phone_sheet_browser_test.go

Loading diff…

internal/docs/static/{editor.470aeecd64ebb8df.js => editor.4db3c5911184ef23.js}

Loading diff…