Add --select to trim a recording's lead-in#79
Conversation
Forwards a --select value to agg's --select so a recording's lead-in can be trimmed at render time. This is useful for sixel apps (e.g. Terminal.Gui's Mandelbrot scenario) that paint a cell-based fallback frame before the terminal's sixel-capability handshake completes: --select 0.1.. drops that pre-handshake frame so the GIF opens on the real sixel content instead of a one-frame fallback flash. The value is plumbed through gif.Config.Select into renderArgs and exposed on both the record and render commands. Covered by a renderArgs unit test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 377d82f4ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| cmd.Flags().Float64Var(&flags.config.GIF.LineHeight, "line-height", flags.config.GIF.LineHeight, "Line-height multiplier") | ||
| cmd.Flags().Float64Var(&flags.config.GIF.LetterSpacing, "letter-spacing", flags.config.GIF.LetterSpacing, "Letter-spacing adjustment in pixels (negative closes gaps)") | ||
| cmd.Flags().Float64Var(&flags.config.GIF.Speed, "speed", flags.config.GIF.Speed, "Render speed multiplier before frame selection") | ||
| cmd.Flags().StringVar(&flags.config.GIF.Select, "select", flags.config.GIF.Select, "agg --select frame range (e.g. \"0.2..\") to trim the recording's lead-in") |
There was a problem hiding this comment.
Keep snapshot assertions on the selected timeline
When --select is used with snapshot plus --print-frame-text or either assertion flag, the PNG renderer applies this agg selection before choosing --frame, but runSnapshot still reconstructs text from result.CastPath using only flags.frame on the unselected cast. For example, snapshot --select 0.2.. --frame 0 --assert-contains ... renders the first post-trim frame while the assertion inspects the original frame 0, so snapshot checks can fail or pass against content that is not in the produced PNG.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ead58e3 by removing --select from the snapshot command (it stays on record). You're right that on snapshot it desynced the two timelines: the PNG was rendered on agg's selected timeline while the assert / print-frame-text path read ExtractFrameTextForSelection(result.CastPath, flags.frame) from the unselected cast by index. --select exists to trim a recording's lead-in (a GIF concern), and snapshot can already target any frame with --frame at:<ms>, so dropping it there is the clean resolution rather than reimplementing agg's selection semantics in the text extractor. Guarded by TestSelectFlagOnlyOnRecord (record has it, snapshot does not) and TestRecordCommandParsesSelect.
The snapshot command renders its PNG on agg's selected timeline but reconstructs assertion / print-frame-text from the unselected cast by frame index, so --select made the inspected frame disagree with the rendered one (e.g. `snapshot --select 0.2.. --frame 0 --assert-contains`). --select exists to trim a recording's lead-in, which is a GIF concern; snapshot already targets any frame via --frame at:<ms>, so drop --select there and keep it on record. Guarded by TestSelectFlagOnlyOnRecord (record has it, snapshot does not) and TestRecordCommandParsesSelect (the value reaches GIF.Select). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add --select to pass agg's frame range through
Forwards a --select value to agg's --select so a recording's lead-in can be
trimmed at render time. This is useful for sixel apps (e.g. Terminal.Gui's
Mandelbrot scenario) that paint a cell-based fallback frame before the
terminal's sixel-capability handshake completes: --select 0.1.. drops that
pre-handshake frame so the GIF opens on the real sixel content instead of a
one-frame fallback flash.
The value is plumbed through gif.Config.Select into renderArgs and exposed on
both the record and render commands. Covered by a renderArgs unit test.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com