Seed the mouse editor from its target, and mark the target on the first edit (improvise-ugj4, improvise-jibp)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
This commit is contained in:
@@ -16,7 +16,6 @@ import {
|
||||
|
||||
const cell = (text, extra = {}) => ({
|
||||
text,
|
||||
edit_text: text,
|
||||
numeric: true,
|
||||
error: false,
|
||||
selected: false,
|
||||
@@ -40,7 +39,7 @@ function grouped() {
|
||||
{
|
||||
kind: "data",
|
||||
labels: ["Cold Brew"],
|
||||
cells: [cell("3", { editable: false }), cell("4", { edit_text: "4000" })],
|
||||
cells: [cell("3", { editable: false }), cell("4")],
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -50,7 +49,7 @@ test("a cell's attributes carry the plan's answers back to the handler", () => {
|
||||
const plan = gridPlan(grouped());
|
||||
const last = plan.body.at(-1).cells[1];
|
||||
const action = cellAction(cellAttrs(last), last.editable);
|
||||
assert.deepEqual(action, { row: 1, col: 1, editable: true, editText: "4000" });
|
||||
assert.deepEqual(action, { row: 1, col: 1, editable: true });
|
||||
});
|
||||
|
||||
// improvise-b8ot: the DATA row index is what a click sends, and `gridPlan`
|
||||
|
||||
@@ -8,7 +8,6 @@ import { gridPlan } from "../shell.js";
|
||||
|
||||
const cell = (text, extra = {}) => ({
|
||||
text,
|
||||
edit_text: text,
|
||||
numeric: true,
|
||||
error: false,
|
||||
selected: false,
|
||||
@@ -102,14 +101,6 @@ test("an empty edit buffer still means an editor is open", () => {
|
||||
assert.equal(plan.body[1].cells[0].text, "▏");
|
||||
});
|
||||
|
||||
test("the editor is seeded from the stored value, not the drawn one", () => {
|
||||
const model = grouped();
|
||||
model.rows[1].cells[0] = cell("20,000", { edit_text: "20000" });
|
||||
const plan = gridPlan(model);
|
||||
assert.equal(plan.body[1].cells[0].text, "20,000");
|
||||
assert.equal(plan.body[1].cells[0].editText, "20000");
|
||||
});
|
||||
|
||||
test("an empty totals strip is no strip at all, not a row of blanks", () => {
|
||||
// Gotcha 33: an EMPTY strip means this grid has no totals — records mode,
|
||||
// or an empty grid — so there is nothing to draw and nothing to pad.
|
||||
|
||||
Reference in New Issue
Block a user