Repository navigation
fix(streaming): stop flicker and make wave/blurIn distinct - #167
Merged
Merged
Conversation
A scratch Flutter app for screen recordings lives in demo/. It is git-ignored (so pub publish skips it too) and excluded from the root analyzer, which would otherwise analyse it against the package's config.
Flicker: - The incremental view swapped its root between a Semantics wrapper and the bare column when a reply went quiet. The type change re-inflated the document, so every block entrance replayed (tables faded in again, growIn blocks collapsed and regrew) and SVGs blanked for a frame. The wrapper now stays; only its arguments flip. - A $$ block whose closer arrived split ($ then $) completed with a stray $ inside, failed to parse, and painted raw TeX for one chunk. - The inline hold scanned inside closed \(…\) / \[…\] formulas, read the _ in (z)_i as emphasis, and cut the tail mid-formula, so it fell back to raw source as it closed. Closed formulas are now opaque. Animations: - wave's crest uses the hue of ColorScheme.primary, made vivid and kept clear of the text's lightness; it was a grey indistinguishable from fade. - blurIn keeps its blur while the text is visible and scales it with the font size; the blur used to finish before the text could be seen. - The fade window grows with reveal speed (64 up to 256) instead of cutting entrances short at 64 characters, which the defaults exceeded. Same-step neighbours share one span and only characters still fading are rebuilt, so the default settings cost no more per frame than before. Additive API only: optional accent/fontSize on revealStyleFor and applyReveal; RevealEngine.window, fadingFrom and maxFadeWindow.
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.
Summary
Fixes the flicker seen while streaming and after a reply finishes, and makes the
waveandblurIncharacter animations actually look different fromfade.Flicker
Semanticswrapper (text arriving) and the bare column (quiet, after 250 ms). The type change re-inflated the whole document, so every table, fence and formula played its block animation again (growIncollapsed and regrew), table scroll offsets reset, and SVGs blanked for a frame — also around every pause longer than 250 ms mid-stream. The wrapper now stays; only its arguments flip, and withcontainer: falseand no label it adds no semantics node, so the settled tree is unchanged.$$blocks. When the closing$$arrived split across chunks, the open formula was completed with a stray$inside, failed to parse, and the error fallback drew the source for one chunk (and jumped the height 50 → 76 → 50 px in a probe).\(…\)/\[…\], read the_in(z)_ias emphasis, and cut the tail mid-formula until the next paragraph began. Closed formulas are now opaque to the hold, like code spans.Animations
wave— the crest uses the hue ofColorScheme.primary, made vivid and kept clearly lighter/darker than the text. It used to be a grey derived from the text colour, and Material 3's pastel darkprimaryalone (#BCC2FFon#E4E1E9) is still invisible.blurIn— opacity now runs ahead of the blur, so words are visibly soft while readable; the blur scales with font size (0.2 em, clamped 1.5–8 px). Previously it was under 1 px by half opacity.Performance
RevealEngine.fadingFrom, a binary search over the stamps) instead of a fixed window.A/B, same session, debug VM, min of 3 runs: at defaults (300 chars/s, 0.25 s)
fade/blurInunchanged andwave~7% faster; at 1200 chars/sfade+5%,blurIn+10% (the full entrance now plays instead of being clipped),waveunchanged. Not device measurements.API
Additive only — no breaking changes:
revealStyleFor(..., {Color? accent, double? fontSize})applyReveal(..., {Color? accent, double? fontSize})RevealEngine.window,RevealEngine.fadingFrom,RevealEngine.maxFadeWindowWithout
accent,revealStyleFor'swaveis exactly the old colour (tested).fadeWindowstays at 64, now the starting size.Also: a local
demo/folder is git-ignored and excluded from the root analyzer.Tests
New regression tests, each confirmed to fail without its fix:
reveal_regressions_test.dart— a finished block does not enter again (withisStreamingleft on and off)math_streaming_test.dart— half a$$closer never paints raw source; a closed formula is not held for the markup inside itreveal_effect_test.dart(new) — wave lands in the accent; crest stands out with a pastel dark accent; blurIn soft while visible and scaled by font sizereveal_engine_test.dart— window grows / keeps stamps / is capped;fadingFromis exactThree existing span-shape / engine tests were updated where they pinned the fixed 64 window or used uniform progress (which now correctly merges into one span).
flutter test: 2041 passed, 39 skipped.flutter analyze: clean. Changelog entries are under## Unreleased.