fix(cli, conversation): Show stable raw turn numbers in print headers#810
Merged
Conversation
afd396e to
688e81c
Compare
Turn headers shown by `jp conversation print` now display the pre-projection (raw) turn number rather than the position in the projected iterator. This means the number in the header matches the argument `jp conversation compact --from/--to` accepts, so users can reference a printed turn directly in a compact command without having to account for how many earlier turns were collapsed. In the compacted view, a summary turn that stands in for several raw turns shows the full range it replaced, e.g. `turns 2–5, 12 minutes ago`, while a single-turn summary continues to show `turn N`. The `TurnSelection::Index` path also resolves by raw turn number now, so `jp conversation print --turn N` is consistent with the header. A new `TurnOrigin` enum is returned by `apply_projection()` and threaded through to `TurnRenderer::render_turn`, carrying the mapping from each projected turn back to its raw source turn(s). When no compaction is present every turn maps to `TurnOrigin::Kept` of its own index, so behaviour is unchanged for uncompacted views. Signed-off-by: Jean Mertz <git@jeanmertz.com>
688e81c to
28e6af5
Compare
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.
Turn headers shown by
jp conversation printnow display the pre-projection (raw) turn number rather than the position in the projected iterator. This means the number in the header matches the argumentjp conversation compact --from/--toaccepts, so users can reference a printed turn directly in a compact command without having to account for how many earlier turns were collapsed.In the compacted view, a summary turn that stands in for several raw turns shows the full range it replaced, e.g.
turns 2–5, 12 minutes ago, while a single-turn summary continues to showturn N. TheTurnSelection::Indexpath also resolves by raw turn number now, sojp conversation print --turn Nis consistent with the header.A new
TurnOriginenum is returned byapply_projection()and threaded through toTurnRenderer::render_turn, carrying the mapping from each projected turn back to its raw source turn(s). When no compaction is present every turn maps toTurnOrigin::Keptof its own index, so behaviour is unchanged for uncompacted views.