SVG: add Size fit-height + fix animated-SVG frame quantization - #5
Merged
Merged
Conversation
Set Size "fit-height" (alias fit-rows) trims trailing blank rows but keeps the full Cols width, so a batch of SVG screenshots shares one width — and thus a constant apparent font size when scaled to a fixed display width. Implies FitToContent and grows, never shrinks, so content wider than Cols isn't clipped. ApplySetting and the SettingDeprecations typo lint both normalize separators/case, so fit-height, fit_height, fitheight, and the fit-rows alias all validate.
…ed SVG QuantizeToFramerate now keeps the LAST state in each 1/fps window instead of the first. Event-driven capture records a screen redraw as a short-lived torn frame immediately followed (~10-15ms later, inside one window) by the settled frame. Keeping the first froze that tear for a full display slot — rows from two screens overlapping. Keeping the last drops the transient and shows the settled screen, matching what the raster/GIF path effectively displays. The first and final frames are still always kept.
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
Two related improvements to the browserless SVG renderer, each with tests.
feat:Size fit-height— crop height, keep grid widthSet Size "fit-height"(aliasfit-rows) trims trailing blank rows but keeps the full grid width (Cols × cell width) instead of cropping to the content's right edge like plainfitdoes.The motivation: when you generate a batch of SVG screenshots and scale them to a fixed display width, plain
fitgives each one a different intrinsic width, so the apparent font size jumps from image to image.fit-heightpins a uniform width across the batch while still trimming vertical whitespace.FitToContent.Colsis still contained, never clipped (SetContentExtenttakesMath.Max(cols, Cols)).ApplySettingand theSettingDeprecationstypo lint both normalize separators/case, sofit-height,fit_height,fitheight, andfit-rowsall validate without a spurious "not recognized" warning.fix:keep the settled frame, not the torn one, when quantizing animated SVGQuantizeToFrameratenow keeps the last state in each1/fpswindow instead of the first.Event-driven capture records a screen redraw (a table scrolling in, a TUI repaint) as a short-lived torn intermediate frame immediately followed — often only ~10–15 ms later, inside the same window — by the settled frame. Keeping the first froze the tear for a whole display slot (e.g. a 2 s plateau), producing visible corruption where rows from two different screens overlap. Keeping the last drops the transient and shows the settled screen, which is also what the un-quantized raster/GIF path effectively displays. The first and final frames are still always kept.
Testing
dotnet build VcrSharp.sln— clean (0 warnings, 0 errors)SvgQuantizeTests(transient-then-settled, final-frame-kept, continuous-stream down-sampling, passthrough) andSettingDeprecationsTests.Collect_DoesNotFlagFitHeightSizeVariants— all green (14/14 in the touched classes).