Merge pull request #240 from fiddlerwoaroof/fix/ugj4-jibp-mouse-editor

Mouse editor: seed from the target, report the first edit (improvise-ugj4, improvise-jibp)
This commit is contained in:
Ed Langley
2026-09-23 10:49:45 -07:00
committed by GitHub
12 changed files with 274 additions and 51 deletions
+44 -5
View File
@@ -4989,11 +4989,50 @@ sends no write, and a touched one does". It wraps `Worker.prototype.postMessage`
opens the editor on cell 4, and presses `Enter`. No `SetCell` may be posted.
Then it types `1` and presses `Enter`, and exactly one must be.
**Known gap, filed as improvise-ugj4.** The `<input>` is still seeded from the
painted `editText`, while `EditTarget` captures the cache. A paint made stale
while another editor was open (`repaint` returns early while `editing` is set)
therefore shows old text against a newer seed and version.
**improvise-jibp** is the other residue: the mouse editor has no `touched` flag.
Both gaps this entry used to list are closed: the stale-paint seed
(improvise-ugj4) and the missing `touched` flag (improvise-jibp). See the
entries that follow.
### `a_mouse_target_marked_edited_writes_its_own_seed`
**improvise-jibp**, the Rust half. A target on the seed `"1200"` commits
`"1200"` and composes nothing: that is the control. `edited()` must leave the
seed where it was, and the same text committed through the edited target must
compose a write. **Rival:** `edited()` leaving `touched` false fails this test
and `the_page_opens_its_editor_on_what_the_target_captured`, and nothing else.
### `the_page_opens_its_editor_on_what_the_target_captured`
**improvise-ugj4 and improvise-jibp**, through the wasm-bindgen surface the
page calls. The cell is drawn `"1,200.50"` and stored `"1200.5"`, and
`edit_seed` must return `"1200.5"`. A projected write then moves the cell to
`"777"`. A target taken afterwards seeds `"777"`, and the first target still
seeds `"1200.5"`, because a target is one capture. `typed_cell(later, "777")`
composes nothing, and the same text through `edited_target(later)` composes a
write. **Rival:** as above, `edited()` leaving `touched` false fails here. I
wrote no rival for an `edit_seed` that re-reads the cache. `EditTarget` names a
record, not a position, so that rival would need a lookup the client does not
have.
### a mouse editor typed back to its own seed still writes — `harness/tests/contract.spec.js`
**improvise-jibp**, the page half. The editor opens on cell 4, and the test
types the seed over the selection and presses Enter. Exactly one `SetCell` must
be posted. Before the fix the page sent `typed_cell(target, seed)` with an
untouched target, which composes nothing. **Rival:** delete the page's `input`
listener. This test fails, and the rest of `contract.spec.js` passes (16).
### an editor opened after an unpainted write shows and commits what it captured — `harness/tests/contract.spec.js`
**improvise-ugj4.** The test opens an editor on cell 0, so `repaint` stops.
While it is open, it delivers a synthetic frame that moves cell 4 to `777`. It
builds that frame from the last `Cells` entry the page actually received for
cell 4, changing only `text`, `edit_text` and `value`, so the record and the
version are real. Then it opens cell 4. The `<input>` must show `777`, and
Enter with no edit must post no `SetCell`. **Rival:** seed the `<input>` from the
paint (`drawn.replaceAll(",", "")`). This test fails on the value, and so does
"an untouched mouse editor sends no write, and a touched one does", because the
drawn text is not the seed. The other 15 pass.
### `a_browser_editor_typed_back_to_its_seed_still_writes`