Merge pull request #194 from fiddlerwoaroof/fix/umi4-edit-seed
improvise-umi4: an editor opens on the value, not on its rounded Display
This commit is contained in:
@@ -622,6 +622,13 @@ a value.
|
||||
A browser found this: `tests/lockstep.rs` drove `i` through the host and the
|
||||
client over the same grid, and they disagreed by a comma.
|
||||
|
||||
**It is the value's exact spelling, not its `Display`** (improvise-umi4).
|
||||
`CellValue`'s `Display` writes a non-whole number `{:.4}`, so this field
|
||||
carried `1.2346` for a stored `1.23456789`, and `i` then `Enter` with nothing
|
||||
typed stored the rounded number in both front ends. Every arm that seeds an
|
||||
editor now goes through `CellValue::edit_text` (`core.md` §17). That is the
|
||||
shortest decimal that parses back to the same `f64`.
|
||||
|
||||
`numeric` and `error` are decided by the server for the same reason: it is
|
||||
the side that knows which it was, and re-deriving client-side is how the two
|
||||
ends drift apart. `CellDisplay` is deliberately not *drawn from* a `CellValue`
|
||||
@@ -636,8 +643,9 @@ that `text` was formatted from: `evaluate_aggregated` over the view's
|
||||
because the browser's `yy` has to copy what the TUI's `YankCell` copies, and
|
||||
neither string on the cell can be turned back into it:
|
||||
|
||||
- `edit_text` is `CellValue::to_string()`, which writes a non-whole number
|
||||
`{:.4}` — `1.23456789` becomes `1.2346`.
|
||||
- `edit_text` was `CellValue::to_string()`, which writes a non-whole number
|
||||
`{:.4}`, so `1.23456789` became `1.2346`. improvise-umi4 has since made it
|
||||
exact, but the next bullet still holds.
|
||||
- Re-parsing any text with `typed()` turns number-like text into a number —
|
||||
`Text("007")` becomes `Number(7.0)`.
|
||||
- In a pivot grid `edit_text` is the *stored* cell (`get_cell`), so an
|
||||
@@ -647,7 +655,8 @@ So the value is **projected**, not re-derived (gotcha 47): a client that
|
||||
wants the value asks for the value. It is kept separate from `edit_text`
|
||||
rather than replacing it, because the two answer different questions — what
|
||||
an editor starts with is a *string*, deliberately the one the TUI's buffer
|
||||
holds, and changing it would change what the TUI's own editor shows.
|
||||
holds. (That string was itself lossy until improvise-umi4. The fix changed what
|
||||
the TUI's own editor shows, which was the point.)
|
||||
|
||||
In a records grid the TUI does **not** yank this value: `YankCell` and
|
||||
`PasteCell` resolve the synthetic `(_Index, _Dim)` key, so the TUI yanks
|
||||
|
||||
Reference in New Issue
Block a user