Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(sidebar): cut a long project name to one line in the sessions sidebar and on the welcome screen (#939)

ezwep5ff70829c186
diff --git a/src/renderer/components/SessionsSidebar.tsx b/src/renderer/components/SessionsSidebar.tsx
index ecad5f84e..55c1befff 100644
--- a/src/renderer/components/SessionsSidebar.tsx
+++ b/src/renderer/components/SessionsSidebar.tsx
@@ -633,7 +633,7 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null
variant="monogram"
className="ss-group__monogram"
/>
- <span className="ss-group__name">{g.projectName}</span>
+ <span className="ss-group__name" title={g.projectName}>{g.projectName}</span>
<ProjectBranch project={projects.find((p) => p.id === g.projectId)!} />
{signals.attention > 0 && (
<span className="ss-group__sig ss-group__sig--attention" title="Sessions that need you">
diff --git a/src/renderer/components/WelcomeScreen.tsx b/src/renderer/components/WelcomeScreen.tsx
index 07a310312..0ed1c2ce4 100644
--- a/src/renderer/components/WelcomeScreen.tsx
+++ b/src/renderer/components/WelcomeScreen.tsx
@@ -221,7 +221,7 @@ export function WelcomeScreen({
size={15}
className="welcome__recent-mark"
/>
- <span className="welcome__recent-name">{p.name}</span>
+ <span className="welcome__recent-name" title={p.name}>{p.name}</span>
{p.cwd && <span className="welcome__recent-path">{p.cwd}</span>}
{(sessionCounts?.[p.id] ?? 0) > 0 && (
<span
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index eb845609c..cb660db8b 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -4223,7 +4223,11 @@ body,
.welcome__recent-name {
font-size: 13px;
- flex: none;
+ flex: 0 1 auto;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
.welcome__recent-path {
@@ -9291,7 +9295,7 @@ button.group-node__setup:disabled {
}
.ss-group__chev:hover { background: rgba(var(--tint-rgb), 0.12); color: var(--text); }
.ss-group__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
-.ss-group__name { font-size: 12px; font-weight: 600; color: var(--text); }
+.ss-group__name { flex: 0 1 auto; min-width: 0; font-size: 12px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-group.is-active .ss-group__name { color: var(--accent); }
.ss-group__branch { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-group__count { font-size: 10px; color: var(--muted); }
diff --git a/src/renderer/styles.sidebar-row.test.ts b/src/renderer/styles.sidebar-row.test.ts
index a3aaf79cf..93e31c02f 100644
--- a/src/renderer/styles.sidebar-row.test.ts
+++ b/src/renderer/styles.sidebar-row.test.ts
@@ -81,3 +81,30 @@ describe('sessions-sidebar row: the name outranks the chips', () => {
expect(ROW).toMatch(/className="ss-chip" title=\{row\.session\}/)
})
})
+
+/**
+ * A project name is free text and can be anything a user pastes into a rename field — a 2,798-
+ * character prompt copied out of a terminal, in the case that prompted this. MEASURED in Electron
+ * against these rules with such a name: the sidebar's project header grew to 1,190px tall, and a
+ * "Recently closed" row on the welcome screen held a 16,162px-wide name in its 480px width, pushing
+ * the folder path and the delete button out of view. Both now cut the name to one line, the way
+ * `.ss-subgroup__name` and `.tab__name` already do.
+ */
+describe('project names stay on one line', () => {
+ it.each(['.ss-group__name', '.welcome__recent-name'])('%s ellipsizes instead of wrapping or overflowing', (sel) => {
+ const r = sel === '.ss-group__name' ? rule(sel) : blockRule(sel)
+ expect(r).toContain('white-space: nowrap')
+ expect(r).toContain('overflow: hidden')
+ expect(r).toContain('text-overflow: ellipsis')
+ // A flex item's automatic minimum is its content, so without these it cannot shrink at all.
+ expect(r).toContain('min-width: 0')
+ expect(r).toMatch(/flex: 0 1 auto/)
+ })
+})
+
+/** The body of a multi-line rule (`.sel {` on its own line), as the welcome screen's rules are written. */
+function blockRule(sel: string): string {
+ const i = CSS.indexOf(`\n${sel} {\n`)
+ expect(i, `no rule for ${sel}`).toBeGreaterThan(-1)
+ return CSS.slice(i, CSS.indexOf('}', i))
+}