Repository navigation
Visualizer: one height while stepping (embed) - #52
Merged
Merged
Conversation
In a compact host (the embed, whose height follows its content) the canvas is as tall as its tallest step from the start: up to 120 likely tallest steps are drawn once, hidden, and measured, through the same StepView and root Frame as the visible step. The console reserves the last step's output. The embed caps the visualizer at 80% of the course window (windowHeight, from the macro; else the screen's), so a taller step scrolls inside it. The step-dependent parts of the root Frame's props are now plain functions (stepViewAt and its helpers). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… for it The measuring state names the trace and mode it was made for, so a new trace never renders the old candidates or reads as measured; the view shows data-steady-height="measuring"/"done". The browser checks wait for "done" before reading the visualizer, since the hidden copies have the same markup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The visualizer keeps one height while stepping, in all modes, so the LiaScript page around the embed doesn't move. It comes before mode «Baum», as agreed.
What
In a
compacthost (the embed, whose height follows its content), while visualizing:.visualizer-measure, at the canvas's width, inside the same container, so the same CSS applies), measures them, and keeps the tallest.steadyHeightCandidates).fib(6)and a few milliseconds for short traces.data-steady-height="measuring", then"done".inertandaria-hidden, and they sit outside the canvas, which all of the visualizer's own DOM queries are scoped to..visual-output-steady), so aprintdoesn't make it grow.windowHeight, which the macro passes; glpython-liascript PR to follow). A taller step scrolls inside the visualizer, which already follows the current step vertically and the active box horizontally.size=largethe cap is at least the large visualizer's height.windowHeight(an older macro), the screen's height stands in for the window's.compact, its visualizer has a fixed height and scrolls already.Refactor, no behaviour change: the step-dependent props of the root
Frameare now plain functions:stepViewAt,declareTargetFor,pendingCallFor,framesWithPendingCall,collapsedCallsOf,inlineHostIn. The workspace'srootFrame(view)renders both the visible step and the measured ones, so the two can't drift apart.Measured: embed height per step (Chrome,
windowHeight=900)fakultaet(4)fakultaet(4)summe([3, 1, 4, 1, 5])printfib(6)(more than 120 steps), 420 px wideThe 957 and 986 px rows are at the cap. At every step of these runs, the current line was inside the visualizer's view.
In the LiaScript player (headless Chrome, window 800 px, glpython-liascript branch
feature/window-height,fakultaet(5)in Kasten, 59 steps): the iframe stays at 878 px. Onmainit grows in seven sizes, from 447 to 1089 px.Checks
scripts/check-console-browser.mjs, new «steady height» block withwindowHeight=900, for a recursion in Kasten and in Ersetzung and for a loop that prints:I ran it against
main's build: it fails there («one height for every step») and passes here.Waiting for the measurement: the hidden copies have the same markup as the visible step, so a check that reads the visualizer during the measurement could find a variable twice. That's what failed in this PR's first CI run. All visualizer checks now wait for
data-steady-height="done"first. I ran them with the measurement slowed down on purpose (one step per frame), and they pass.Shared checks: a host's or a test's selector over the whole page can also match the hidden copies while measuring, for about 0.1 s. That's why the state is visible.
Locally,
lint(the known warning only),test:runtime,test:protocol,test:hints,test:layoutandtest:console(twice) pass.How it goes live
windowHeight, so the cap is 80% of the real course window. It works with the embed before this PR too, which ignores the parameter. Courses need a patch version bump for it.Manual tests (desktop, and iPad with an external keyboard)
In a LiaScript block:
fakultaet(5)with@GLPython.eval(box). Visualize, then step forward and back with → and ←.summeon lists.print: the console has its final height from the first step, and the lines appear in it one by one.large(projector,@GLPython.visual(large)): at least as tall as before, still steady.print(1 + 2)): no empty area appears below the code.Follow-ups (not fixed)
windowHeight, the screen's height is a rough stand-in. A course window much smaller than the screen gets a cap that's too large.min-heightalso applies. It only adds scroll room there, as before.🤖 Generated with Claude Code