Skip to content

feat: support the hide method for configuring long git branch names - #16663

Open
wzc520pyfm wants to merge 3 commits into
warpdotdev:masterfrom
wzc520pyfm:wzc520pyfm/git-branch-prompt-display
Open

wzc520pyfm wants to merge 3 commits into
warpdotdev:masterfrom
wzc520pyfm:wzc520pyfm/git-branch-prompt-display

Conversation

@wzc520pyfm

Copy link
Copy Markdown
Contributor

Description

Long git branch names in the prompt chip are still shortened to 40 characters. The hidden part is still replaced with an ellipsis. The default continues to hide the start of the name.

Settings → Features → Terminal now has two controls:

  • Long git branch names chooses which part to hide.
    • Omit the start is the existing behavior: …ng-feature-that-needs-to-be-implemented
    • Omit the end keeps a ticket prefix visible: ABC-123-some-long-feature-that-needs-to…
    • Omit the middle keeps a fixed number of characters from each end: ABC-123-some…-implemented
  • Characters kept at each end applies only to Omit the middle. The defaults are 12 characters from the start and 12 from the end. If those edges plus the ellipsis would pass the 40-character chip, the end shrinks before the start so a ticket id survives. Short names, and names already covered by the two edges, stay whole.

The command palette can switch between hiding the start and hiding the end. Hiding the middle is chosen from the dropdown. The same formatting applies to the git branch status chip.

In settings.toml:

  • terminal.prompt.git_branch_name_truncation: omit_start (default), omit_end, or omit_middle
  • terminal.prompt.git_branch_name_prefix_chars: default 12
  • terminal.prompt.git_branch_name_suffix_chars: default 12

The middle commit on this branch mentions a display pattern. The final diff uses the character counts above instead.

Linked Issue

#16634

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

The issue is triaged and reproducible, and it does not currently have ready-to-spec or ready-to-implement.

Testing

  • I have manually tested my changes locally with ./script/run

Added app/src/util/git_branch_display_tests.rs. It covers the existing start-hiding behavior, end hiding, middle hiding, the 40-character cap, unicode boundaries, and the settings values.

  • cargo test -p warp --lib -- git_branch_display file_defaults_validate_against_schema — 13 passed
  • cargo clippy -p warp --lib --tests -- -D warnings

Manual check used the branch ABC-123-some-long-feature-that-needs-to-be-implemented from issue 16634.

Screenshots / Videos

Omit the start. The ellipsis stays at the beginning:

image

Omit the end. ABC-123 stays visible and the ellipsis moves to the end:

image

Omit the middle, with 12 characters kept on each side:

image image image
git-branch-ellipsis-modes.mp4

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-IMPROVEMENT: Long git branch names in the prompt can hide the end or the middle instead of the start, and an ellipsis stays where text was removed.

@cla-bot

cla-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @cursoragent on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment @cla-bot check to trigger another check.

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Oct 28, 2026
@wzc520pyfm

wzc520pyfm commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@wzc520pyfm wzc520pyfm changed the title Let the prompt chip choose which part of a long git branch name to hide feat: Support the hide method for configuring long git branch names Oct 28, 2026
@wzc520pyfm wzc520pyfm changed the title feat: Support the hide method for configuring long git branch names feat: support the hide method for configuring long git branch names Oct 28, 2026
Long branch names were always truncated from the start, which hides ticket prefixes. Add a truncation-direction setting and an optional display regex, with Features settings and a command palette toggle.

Co-authored-by: wzc520pyfm <1528857653@qq.com>
The features page is mid-update while the editor blur or enter event is delivered, so a synchronous typed-action dispatch never reached the handler and the pattern was discarded.

Co-authored-by: wzc520pyfm <1528857653@qq.com>
Drop the display regex. The prompt still hides the start of a long name by
default, and a setting can hide the end instead. A separate pair of character
counts hides the middle while keeping both edges.

Co-authored-by: wzc520pyfm <1528857653@qq.com>
@cursor
cursor Bot force-pushed the wzc520pyfm/git-branch-prompt-display branch from 4e58df3 to 5127c82 Compare October 28, 2026 06:17
@cla-bot cla-bot Bot added the cla-signed label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant