Check a new chart sheet in the hosted engine too

The native engine's WorkbookAddSheet returns the new sheet and the
portable one returns 1 or 0, so the chart command's `== null` check did
not compile in hosted builds (Werkzeug's Workbook bundle). Check each
engine's own result, as the grid already does.

Local tests (no local overrides, through build-queue): the hosted
KRYON_HOSTED_UI bundle builds and src/app.zi passes ziran fmt --check;
make build, the private-Xvfb desktop test, grid test and source audit
pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
waoziandClaude Opus 5.5 committed 2026-11-16 22:23:25 -03:00
1 parent 84829a56e8
commit 55e72dd202
1 file changed
+8 -1
+8 -1
View File
@@ -1168,7 +1168,14 @@ CreateFormulaChart :: () {
SetText(name[:], "Chart ")
digits: [16]u8
AppendText(name[:], FormatInteger(cast(s64)Engine.WorkbookSheetCount(workbook) + 1, digits[:]))
if Engine.WorkbookAddSheet(workbook, Engine.CText(TextUntilNul(name[:]))) == null {
// The native engine returns the new sheet; the portable one, 1 or 0.
added: bool
#if #defined(KRYON_HOSTED_UI) {
added = Engine.WorkbookAddSheet(workbook, Engine.CText(TextUntilNul(name[:]))) != 0
} else {
added = Engine.WorkbookAddSheet(workbook, Engine.CText(TextUntilNul(name[:]))) != null
}
if !added {
SetText(status[:], "Could not add a chart sheet")
return
}