From 6479d90ca55a978553af14e4da4db183fe61131c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 30 Mar 2026 10:09:26 -0700 Subject: [PATCH] example/wasm-vt: use ghostty_type_json for struct layouts Replace hardcoded byte offsets and struct sizes with dynamic lookups from the ghostty_type_json API. On WASM load, the type layout JSON is fetched once and parsed into a lookup table. Two helpers, fieldInfo and setField, use this metadata to write struct fields at the correct offsets with the correct types. This removes the need to manually maintain wasm32 struct layout comments and magic numbers for GhosttyTerminalOptions and GhosttyFormatterTerminalOptions, so the example stays correct if the struct layouts change. --- example/wasm-vt/index.html | 71 ++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/example/wasm-vt/index.html b/example/wasm-vt/index.html index 7ed1f7b9d..6ec4e2408 100644 --- a/example/wasm-vt/index.html +++ b/example/wasm-vt/index.html @@ -117,6 +117,7 @@