Skip to content

feat(tui): collapse long command lines behind Ctrl+O - #212

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/tui-collapse-long-commands
Aug 3, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/tui-collapse-long-commands

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Summary

  • Command-execution activity entries (bash validation commands like cargo test ...; git diff --check; git status --short) whose collapsed line would exceed 80 chars now truncate to the first command/pipe segment plus a "· N output lines" suffix in theme::dim(), instead of rendering the full raw command inline.
  • Reuses the existing Ctrl+O mechanism exactly as-is: no new keybinding, no new focus-tracking state. The global tool_detail.expanded flag (toggled by SemanticCommand::ToggleToolDetails, bound to Ctrl+O in app/commands.rs) already flows into ConversationViewOpts::tool_expanded → ActivityGroupPresentation::expanded, and full detail was already revealed via that same p.expanded check in the render loop when toggled — this change only affects what the collapsed line shows, not how/when it expands.
  • Detection is content-based, not type-based: collapsed_command_summary() only kicks in when the block's count_label starts with "$ " (i.e., is actually a raw command line) — exploring/implementing groups (e.g. "3 files inspected") are untouched, and commands under the 80-char threshold render exactly as before.
  • 80 matches the truncation length already used elsewhere in this file for the wrote · write/edit summary, rather than introducing a new magic number.
  • Also fixed activity_entry_from_tool's collapsed label for solo (non-grouped) validation commands, which previously showed a useless generic "1 item" instead of the command itself — now consistent with the pre-grouped ChatItem::ActivityGroup path, which already exposed the raw command.

Test plan

  • cargo fmt --all -- --check
  • cargo test --package forge-tui --lib (707 passed), including new tests: long_command_entry_collapses_with_truncated_line_and_output_count, long_command_entry_expands_full_text_via_ctrl_o, short_command_entries_are_unaffected, collapsed_command_summary_splits_at_first_pipe_or_semicolon, collapsed_command_summary_ellipsizes_an_overlong_single_segment, collapsed_command_summary_ignores_short_commands.
  • git diff --check

@github-actions
github-actions Bot enabled auto-merge (squash) August 3, 2026 14:19
@github-actions
github-actions Bot merged commit fbc0109 into main Aug 3, 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