Skip to content

Add --select to trim a recording's lead-in#79

Merged
tig merged 2 commits into
mainfrom
claude/agg-select-passthrough
Jun 6, 2026
Merged

Add --select to trim a recording's lead-in#79
tig merged 2 commits into
mainfrom
claude/agg-select-passthrough

Conversation

@tig

@tig tig commented Jun 6, 2026

Copy link
Copy Markdown
Member

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

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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread cmd/tuirec/main.go Outdated
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")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@tig tig merged commit 11f4bb3 into main Jun 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant