Repository navigation
Agents window: ellipsize long folder and branch names in the title bar - #348362
Draft
Alexandru Dima (alexdima) wants to merge 1 commit into
Draft
Alexandru Dima (alexdima) wants to merge 1 commit into
Alexandru Dima (alexdima) wants to merge 1 commit into
Conversation
The workspace and branch labels in the Agents window title bar were flex containers. text-overflow does not apply to the text of a flex container, so long names were clipped mid-letter without an ellipsis. Make them block boxes; their flex parent groups already center them vertically. Fixes #315714 🤖 Authored with GitHub Copilot on behalf of @alexdima. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the workspace and branch label ellipsis fix.
No open issues 🎉
What changed in this PR
Fixes #315714 by making long workspace and worktree branch names end with an ellipsis rather than clipping mid-character in the Agents window command center.
Changes:
- Changes both labels from flex to block layout so ellipsis styling takes effect, while preserving shrinking and parent-controlled vertical alignment.
- Adds a regression test covering overflow, ellipsis styling, and vertical centering for both labels.
| File | Description |
|---|---|
src/vs/sessions/contrib/sessions/test/browser/sessionsTitleBarWidget.test.ts |
Adds narrow-layout coverage for long workspace and branch names. |
src/vs/sessions/contrib/sessions/browser/media/sessionsTitleBarWidget.css |
Enables label ellipses and removes unnecessary flex-label styling. |
Review effort: Balanced
This branch has not been deployed
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.
Fixes #315714
Problem
In the Agents window, the command center shows the session's folder name (and the branch for worktree sessions). When the name is too long to fit, it is cut off in the middle of a letter (
…will-not-fit-in-the-titl) instead of ending with…. Nothing tells the user that the name was truncated.Demo
The same scenario recorded twice, on the installed Insiders (BEFORE) and on this branch (AFTER):
315714-before-after-side-by-side.mp4
Cause
.agent-sessions-titlebar-workspaceand.agent-sessions-titlebar-branchalready haveoverflow: hidden; text-overflow: ellipsis, but they are alsodisplay: flex.text-overflowonly applies to block containers. In a flex container the text sits in an anonymous flex item, so the label clips the text and draws no ellipsis.Change
sessionsTitleBarWidget.css: the two labels becomedisplay: block. I removedalign-items: centerandheight: 100%because they only made sense for a flex label. The parent group is a flex container withalign-items: center, so it still centers the labels vertically, and the regression test checks this.flex: 0 1 auto; min-width: 0stay, so the labels still shrink.sessionsTitleBarWidget.test.ts: new testellipsizes long workspace and branch names in the command center. It renders a long workspace name and a long branch name in a narrow command center, then checks that each label isdisplay: blockwithtext-overflow: ellipsis, that it actually overflows, and that it stays vertically centered.How I tested
./scripts/test.sh --run src/vs/sessions/contrib/sessions/test/browser/sessionsTitleBarWidget.test.tsdisplay: flex.pnpm run oxlinton the changed files: clean.my-really-long-project-folder-name-that-will-not-fit-in-the-title, then check the title label.--dev): T4 PASSED. "label is display:block with text-overflow:ellipsis (text needs 503px, label is 365px)". The name ends with….I didn't record the branch label in a live session, because only worktree sessions show it. It uses the same CSS rule as the folder label, and the unit test covers both.
Related earlier changes to this widget: #309117, #339856, #337784, #348107.
Before / after
Before
315714-before.mp4
After
315714-after.mp4
🤖 Authored with GitHub Copilot on behalf of Alexandru Dima (@alexdima).