Skip to content

Commit 81a5173

Browse files
committed
fix: paint first frame for reduced-motion, preserve mobile agent count, cleanups
- terminal.ts: paint one unconditional frame after refit() so reduced-motion visitors (and the first rAF before pause fires) always see a mature network - terminal.ts: capture agentCount at mount time; re-apply after set_preset so mobile's 12k override survives preset switches - tslime-wasm/Cargo.toml: drop silently-ignored [profile.release] (workspace profile wins; cargo was warning on every build) - tslime-wasm/src/lib.rs: doc tick() noting it is a no-op in headless/ANSI mode - pages.yml: widen path filter to include src/render/** and src/simulation/** so wasm rebuilds trigger on any core rendering or simulation change
1 parent a2ed6f5 commit 81a5173

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

.github/workflows/pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Pages
22
on:
33
push:
44
branches: [master]
5-
paths: ['web/**', 'tslime-wasm/**', 'src/render/ansi.rs', '.github/workflows/pages.yml']
5+
paths: ['web/**', 'tslime-wasm/**', 'src/render/ansi.rs', 'src/render/**', 'src/simulation/**', '.github/workflows/pages.yml']
66
workflow_dispatch:
77
permissions:
88
contents: read

tslime-wasm/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,3 @@ path = ".."
3434
default-features = false
3535
features = []
3636

37-
[profile.release]
38-
opt-level = "s"
39-
lto = true

tslime-wasm/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ impl TslimeWasm {
130130
)
131131
}
132132

133+
/// Steps + renders to the WebGL canvas. In headless/ANSI mode this produces
134+
/// no output (no renderer) — use `render_ansi_frame` instead.
133135
pub fn tick(&mut self) {
134136
self.step();
135137
self.render();

web/src/terminal.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ export async function mountTerminal(
3535
try { term.loadAddon(new WebglAddon()); } catch { /* DOM fallback */ }
3636
}
3737

38+
const agentCount = opts.agents;
3839
const sim = new TslimeWasm(SIM_W, SIM_H, '', SEED);
39-
if (opts.agents) sim.set_agent_count(opts.agents);
40+
if (agentCount) sim.set_agent_count(agentCount);
4041

4142
// Build name -> id maps from the wasm registries (avoids index drift).
4243
const presetId = new Map<string, number>();
@@ -73,10 +74,11 @@ export async function mountTerminal(
7374
}
7475
requestAnimationFrame(frame);
7576
};
77+
if (cols > 0 && rows > 0) term.write(sim.render_ansi_frame(cols, rows));
7678
requestAnimationFrame(frame);
7779

7880
return {
79-
setPresetByName(name) { const id = presetId.get(name); if (id !== undefined) sim.set_preset(id); },
81+
setPresetByName(name) { const id = presetId.get(name); if (id !== undefined) { sim.set_preset(id); if (agentCount) sim.set_agent_count(agentCount); } },
8082
setPaletteByName(name) { const id = paletteId.get(name); if (id !== undefined) sim.set_palette(id); },
8183
pause() { paused = true; },
8284
resume() { paused = false; },

0 commit comments

Comments
 (0)