Skip to content

Commit 3ffd594

Browse files
authored
Show the portion of the console working directory that we can (#13724)
A quick change to show the portion of the working directory in the console that we can, instead of letting it disappear when the console is narrow or the directory name is long. You can hover to see the whole thing. <img width="525" height="350" alt="image" src="https://github.com/user-attachments/assets/8b7d692c-fb1e-459c-b3de-939e4672ddfa" /> This is a pretty simple approach; it might be interesting to collapse _portions_ of the paths so you can see e.g. the beginning and ending segments, but want to keep this simple for now. Fixes #12772. ### Release Notes <!-- Optionally, replace `N/A` with text to be included in the next release notes. The `N/A` bullets are ignored. If you refer to one or more Positron issues, these issues are used to collect information about the feature or bugfix, such as the relevant language pack as determined by Github labels of type `lang: `. The note will automatically be tagged with the language. These notes are typically filled by the Positron team. If you are an external contributor, you may ignore this section. --> #### New Features - N/A #### Bug Fixes - Fix issue causing working directory to disappear in Console tab when it is long or console is narrow (#12772). ### Validation Steps 1. Change to a directory that has a long name 2. Shrink the Console 3. Hover over the truncated text
1 parent 4bda21d commit 3ffd594

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/vs/platform/positronActionBar/browser/positronDynamicActionBar.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ export interface DynamicActionBarAction {
7777
* should appear as a submenu in the overflow menu.
7878
*/
7979
overflowContextMenuSubmenu?: OverflowContextMenuSubmenu;
80+
81+
/**
82+
* When true, the action shrinks to fit the available space instead of
83+
* being dropped from the layout. The action's component is responsible for
84+
* truncating its content (e.g. via CSS text-overflow: ellipsis).
85+
*/
86+
growable?: boolean;
8087
}
8188

8289
/**
@@ -301,6 +308,16 @@ export const PositronDynamicActionBar = (props: PositronDynamicActionBarProps) =
301308

302309
// Handle overflowing.
303310
if (separatorWidth + width > layoutWidth) {
311+
// Growable actions shrink to fill remaining space instead of being dropped,
312+
// as long as the fixed width still fits. The component handles truncation.
313+
if (action.growable && action.fixedWidth + separatorWidth <= layoutWidth) {
314+
width = layoutWidth - separatorWidth;
315+
gridEntries.push({ width, action });
316+
layoutWidth = 0;
317+
overflowing = true;
318+
overflowActions.push(...actions.slice(i + 1).filter(hasOverflowEntry));
319+
return;
320+
}
304321
overflowing = true;
305322
overflowActions.push(...actions.slice(i).filter(hasOverflowEntry));
306323
return;

src/vs/workbench/contrib/positronConsole/browser/components/actionBar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ export const ActionBar = (props: ActionBarProps) => {
366366
fixedWidth: DEFAULT_ACTION_BAR_BUTTON_WIDTH,
367367
text: directoryLabel,
368368
separator: false,
369+
growable: true,
369370
component: <CurrentWorkingDirectory directoryLabel={directoryLabel} />
370371
}
371372
];

src/vs/workbench/contrib/positronConsole/browser/components/currentWorkingDirectory.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
.current-working-directory-label {
77
display: flex;
8+
width: 100%;
9+
min-width: 0;
810
font-size: 12px;
911
overflow: hidden;
1012
align-items: center;
@@ -13,10 +15,12 @@
1315

1416
.current-working-directory-label .codicon {
1517
padding-top: 1px;
18+
flex-shrink: 0;
1619
color: var(--vscode-positronActionBar-foreground);
1720
}
1821

1922
.current-working-directory-label .label {
23+
min-width: 0;
2024
overflow: hidden;
2125
padding-left: 5px;
2226
white-space: nowrap;

0 commit comments

Comments
 (0)