Skip to content

feat: make bash command display length adapt to terminal width#550

Closed
li0near wants to merge 1 commit into
jarrodwatts:mainfrom
li0near:feat/configurable-bash-command-length
Closed

feat: make bash command display length adapt to terminal width#550
li0near wants to merge 1 commit into
jarrodwatts:mainfrom
li0near:feat/configurable-bash-command-length

Conversation

@li0near

@li0near li0near commented May 14, 2026

Copy link
Copy Markdown

Summary

Bash commands in the tools activity line were hardcoded to truncate at 30 characters, which often cuts off useful context (e.g., git commit -m "Fix auth... instead of the full command).

This PR:

  • Makes truncation dynamic based on terminal width ($COLUMNS), so wider terminals show more of the command
  • Adds a display.toolTargetMaxLength config option for explicit control:
    • 0 (default): auto-detect from terminal width
    • Any positive number: use as the max character length
  • Updates the path truncation in tools-line.ts to also respect this config

Config example

{
  "display": {
    "toolTargetMaxLength": 80
  }
}

Or set to 0 (default) to auto-fit to terminal width.

Test plan

  • All 576 existing tests pass
  • Updated the bash truncation test to verify terminal-width-based behavior
  • Build passes cleanly with tsc

Previously, bash commands in the tools activity line were hardcoded
to truncate at 30 characters, which often cut off useful context.

This change makes the truncation dynamic based on the terminal width
(via $COLUMNS), so wider terminals show more of the command.

Additionally, a new `display.toolTargetMaxLength` config option is
added:
- 0 (default): auto-detect from terminal width
- Any positive number: use that as the max character length

The path truncation in the tools line renderer also respects this
config, falling back to terminal-width-based auto-sizing.
@li0near li0near requested a review from jarrodwatts as a code owner May 14, 2026 14:07
@jarrodwatts

Copy link
Copy Markdown
Owner

Thanks for the PR. This is superseded by #571, which merged configurable tool-name length and safer render-time wrapping. This branch also expands transcript-derived Bash targets using env-derived width and exposes longer untrusted command text on the tools line, which is too risky for the hot statusline path.

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.

2 participants