Repository navigation
feat(tui): format shell commands for readability - #47798
Closed
kerrnelPanic wants to merge 1 commit into
Closed
kerrnelPanic wants to merge 1 commit into
kerrnelPanic wants to merge 1 commit into
Conversation
kerrnelPanic
force-pushed
the
format-shell-commands
branch
from
September 11, 2026 09:40
70e79ff to
d0f5ffb
Compare
|
Rebased onto latest dev (v1.18.30 + unreleased). No content changes — same single feature commit, updated base. |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
1 task done
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.
Issue for this PR
References #38526
Type of change
What does this PR do?
Long shell commands with pipes, semicolons, and
&&/||chains wrap mid-token at the terminal edge, making them hard to read in the permission prompt and session view.This adds a
formatShellCommand()utility that inserts line breaks at top-level shell operators (;,|,&&,||,;;,|&) when a command exceeds 60 characters. It's quote-aware (won't split inside single/double quotes, backticks), and also respects shell comments, heredoc bodies, and arithmetic expansion$((...)). Continuation lines are indented two spaces.Applied in two places:
permission.tsx)index.tsx, Shell component)How did you verify your code works?
Tested 13 edge cases including quoted operators, backticks, heredocs, arithmetic expansion, comments, escaped operators, pre-existing newlines, and the full compound command from the screenshots. Typecheck passes (no new errors).
Screenshots / recordings
Before — command wraps mid-token at terminal edge:
After — command split at shell operators with 2-space indent:
Checklist