Repository navigation
feat(tui): sort tables and collapse trees in visualizations - #2120
Merged
Merged
Conversation
Table headers in a finished `rustcode-viz` widget sort on click (again to flip, numeric columns by value, ▲/▼ marker), and tree nodes with children fold on click (▾/▸, "N hidden" hint), mirroring the macOS app. The view state lives only in TranscriptState, keyed by (history index, viz ordinal) plus a hash of the fence body. It is never persisted, sent to the provider, or applied to /copy or export. The committed block cache keys on it, the renderer reports clickable spans next to the rows, and the projection maps them to painted cells like tool rows. Live streams, open fences, and terminal scrollback stay non-interactive. Keyboard access is left for a follow-up: the transcript has no focus model inside messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # rustcode/tui/src/ui/tests.rs
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.
Closes #2088
Finishes the scope left open after #2094: interactive
rustcode-vizwidgets in the TUI, matching the macOS app.Behavior
▲/▼. A click overrides the payload'ssort_by, which gets the same marker. Every row is sorted before the 50-row cap. Narrow key/value tables have no header row, so they can't be re-sorted.▾/▸. Clicking the marker or label folds or unfolds the node, and a folded node showsN hidden. Every node starts open, as in the current render. Nodes cut off by the depth limit get no marker.Design
VizView { source, sort, toggled }is stored inTranscriptState.viz_views, keyed by(history index, viz ordinal).sourceis a hash of the fence body, so state made for another body is ignored. It exists only in terminal UI state: it is not persisted, not sent to the provider, and does not touch/copyor export. The canonical text is unchanged.render_visualization_with_view) returns clickable spans with the rows. Table header columns are read from the Markdown grid's span structure, and anything that doesn't match that shape yields no targets. Tree node ids are preorder ids over the whole tree, so they stay stable when nodes above them fold.committed_blockrenders assistant messages throughrender_committed_history_block_interactive. The committed block cache key hashes that message's view state, so a toggle redraws and nothing stale is left on screen. Hits are cached next to the rows, the same way astool_owner_cache. The projection maps hits to painted cells next to tool and message rows (viz_line_flags, thenset_viz_rows, thenviz_target_at).Deferred
ctrl+shift+osteps tool output only), so this stays mouse-first. It is documented as a follow-up indocs/visualizations.md.Tests
sort_byoverride, header targets covering their columns and picking the next direction, no targets for narrow tables, tree folding with hidden counts and stable ids, message-level targets offset past the gutter, stale state ignored, live stream not interactive.visualization_headers_and_tree_nodes_are_click_targets_that_redrawrenders a real frame, resolves targets from painted cells, applies them, and checks that the redraw sorts, flips, folds and unfolds while the history text stays unchanged.🤖 Generated with Claude Code