Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ Versions follow [Semantic Versioning](https://semver.org/) — minor bump per su
BROWSE/REPLACE enforcement, field-bound forms, two demo apps, and the GUI wizards all now
agree on one constraint, declared once, on the column.

### Fixed
- A memory-variable `@ SAY GET` no longer shows blank when the variable already holds a
value. Field-binding (#59) rewrote the non-field fallback path to hardcode an empty
prefill instead of reading the variable's current value, silently breaking every demo
form that pre-fills a default via `STORE`: `overtime.prg`'s Week Monday date (Open/Prep
Week, Recalculate Week) and leave date (Register Leave Taken), `INVENTORY.prg`'s stock/
reorder/price/quantity defaults (Add Product, Stock In, Stock Out), and `crm.prg`'s deal
value default (Add Deal). Found by exercising the running app, not by the test suite —
every existing test for this path used a variable with no prior value, where an empty
prefill happens to be correct either way.

## [1.2.0] — 2026-07-09 — TIME columns, WEEK()/DATEADD(), BROWSE cell validation, Overtime demo

### Added
Expand Down
5 changes: 4 additions & 1 deletion src/interpreter/Executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,10 @@ export class Executor implements IndexCommandsHost {
return { output: out };
}
}
this.pendingForm.push({ row, col, label: text, varName, target: { kind: 'var' }, value: '' });
this.pendingForm.push({
row, col, label: text, varName, target: { kind: 'var' },
value: String(this.vars.get(varName) ?? ''),
});
return { output: out };
}

Expand Down
10 changes: 10 additions & 0 deletions tests/FormFieldBinding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ describe('field-bound @ SAY GET', () => {
expect(form.fields[0].value).toBe('');
});

it('a variable GET prefills from the variable\'s current value, not blank', async () => {
const { session, sent, run } = await setup();
await run('APPEND RECORD');
await run('STORE "2026-07-06" TO M_WEEK');
await runBlock(session, sent, '@ 4, 5 SAY "Week: " GET M_WEEK\nREAD');
const form = sent.find(m => m.type === 'form-open') as any;
expect(form.fields[0].target.kind).toBe('var');
expect(form.fields[0].value).toBe('2026-07-06');
});

it('is a variable GET when no table is in use', async () => {
const sent: ServerMessage[] = [];
const session = new Session((m) => sent.push(m));
Expand Down
Loading