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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(tabbar): pin the New project + so it cannot scroll away
Krishna03a716fd5552
diff --git a/CLAUDE.md b/CLAUDE.mdindex 624951a68..b6be70d01 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1972,7 +1972,9 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea- **Welcome** (`WelcomeScreen.tsx`): shown when no projects exist.- **Window chrome**: macOS integrated title bar (`titleBarStyle: 'hiddenInset'`); the tabbar (`TabBar.tsx`) is the drag region with the `nodeterm` logo + a rounded pill of project- tabs. Cmd+M is intercepted in `main/keydown-intercept.ts` (`before-input-event`, installed from+ tabs. The New-project `+` is a **sibling** of `.tabbar__tabs`, not its last child — inside+ the scroller it vanished once the strip overflowed (no visible scrollbar to hint it was+ still there). Cmd+M is intercepted in `main/keydown-intercept.ts` (`before-input-event`, installed from`main/index.ts` — else macOS minimizes) and forwarded to the renderer via `app:toggle-markdown`;Cmd+W (`app:close-node`) and Cmd+0 (`app:zoom-actual-size`) are taken back the same way. **Theapplication menu is OURS**: `buildAppMenu` (`main/index.ts`) calls `Menu.setApplicationMenu` anddiff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsxindex 0a0625e6c..7127955c0 100644--- a/src/renderer/components/TabBar.tsx+++ b/src/renderer/components/TabBar.tsx@@ -1,4 +1,4 @@-import { useEffect, useMemo, useRef, useState } from 'react'+import { useEffect, useMemo, useRef, useState, type DragEvent } from 'react'import { createPortal } from 'react-dom'import { useProjects } from '../state/projects'import { useViewMode, viewFor } from '../state/viewMode'@@ -181,6 +181,21 @@ export function TabBar({setEditingId(null)}+ // Drop-at-end: the strip's empty area AND the pinned + (which used to live inside the+ // scroller, so a drop on it already meant "after the last tab").+ const onEndZoneDragOver = (e: DragEvent) => {+ if (!dragId) return+ e.preventDefault()+ if (dropId !== '') setDropId('')+ }+ const onEndZoneDrop = (e: DragEvent) => {+ if (!dragId) return+ e.preventDefault()+ onReorder(dragId, null)+ setDragId(null)+ setDropId(null)+ }+// The strip scrolls without a visible scrollbar (see .tabbar__tabs), so keep it navigable:// a plain mouse wheel scrolls it horizontally, and the active tab is brought into view.const tabsRef = useRef<HTMLDivElement>(null)@@ -227,6 +242,10 @@ export function TabBar({<span className="brand__name">nodeterm</span></div>+ {/* Projects group: the pill scrolls; the + is a SIBLING so it cannot scroll away+ with the tabs (issue #375). min-width:0 on this wrapper is what lets the pill+ shrink instead of pushing the + off the window. */}+ <div className="tabbar__projects"><divclassName="tabbar__tabs"ref={tabsRef}@@ -235,19 +254,8 @@ export function TabBar({// already produce deltaX). Nothing above the canvas scrolls vertically anyway.if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) e.currentTarget.scrollLeft += e.deltaY}}- // The strip itself is the "drop at the end" zone (per-tab handlers stopPropagation).- onDragOver={(e) => {- if (!dragId) return- e.preventDefault()- if (dropId !== '') setDropId('')- }}- onDrop={(e) => {- if (!dragId) return- e.preventDefault()- onReorder(dragId, null)- setDragId(null)- setDropId(null)- }}+ onDragOver={onEndZoneDragOver}+ onDrop={onEndZoneDrop}>{projects.map((p) => {const active = p.id === activeId@@ -380,8 +388,16 @@ export function TabBar({</div>)})}-- <button className="tab__add" title="New project" onClick={onOpenWelcome}>+ </div>+ <button+ type="button"+ className="tab__add"+ title="New project"+ aria-label="New project"+ onClick={onOpenWelcome}+ onDragOver={onEndZoneDragOver}+ onDrop={onEndZoneDrop}+ >+</button></div>diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 8ddf8fc14..92a4d4f67 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -212,7 +212,8 @@ body,.tabbar button,.tabbar input,.tab,-.tabbar__tabs {+.tabbar__tabs,+.tabbar__projects {-webkit-app-region: no-drag;}@@ -236,7 +237,16 @@ body,letter-spacing: 0.2px;}-/* Tabs as a single rounded pill of segments */+/* Tabs as a single rounded pill of segments. Lives in `.tabbar__projects` with the ++ as a sibling — the + used to be the last child of this scroller, so enough tabs+ hid it with no scrollbar to say it was still there (issue #375). */+.tabbar__projects {+ display: flex;+ align-items: center;+ gap: 4px;+ flex: 1;+ min-width: 0; /* shrink the pill, never shove the + off the window */+}.tabbar__tabs {display: flex;align-items: center;@@ -247,6 +257,8 @@ body,border: 1px solid var(--border);border-radius: 17px;overflow-x: auto;+ flex: 1;+ min-width: 0;/* Scrollable but without the native scrollbar (foreign-looking in a title-bar tab strip);trackpad swipe / wheel still scroll, and the active tab is scrolled into view. */scrollbar-width: none;@@ -400,6 +412,7 @@ body,align-items: center;justify-content: center;align-self: center;+ flex-shrink: 0;width: 28px;height: 28px;background: transparent;diff --git a/src/renderer/styles.tabbar.test.ts b/src/renderer/styles.tabbar.test.tsnew file mode 100644index 000000000..e6140b996--- /dev/null+++ b/src/renderer/styles.tabbar.test.ts@@ -0,0 +1,28 @@+import { describe, expect, it } from 'vitest'+import { readFileSync } from 'node:fs'+import { join } from 'node:path'++const CSS = readFileSync(join(__dirname, 'styles.css'), 'utf8')++function ruleBody(selector: string): string {+ for (const chunk of CSS.split('}')) {+ const brace = chunk.indexOf('{')+ if (brace < 0) continue+ const head = chunk+ .slice(0, brace)+ .replace(/\/\*[\s\S]*?\*\//g, '')+ .trim()+ if (head === selector) return chunk.slice(brace + 1)+ }+ throw new Error(`no rule for ${selector}`)+}++describe('tab bar New-project pin', () => {+ it('lets the tab pill shrink so the + stays in the window', () => {+ // Without min-width:0 the flex item won't shrink below its tab content, so the ++ // (now a sibling) is shoved off the right edge — the same bug at a different layer.+ expect(ruleBody('.tabbar__projects')).toMatch(/min-width:\s*0/)+ expect(ruleBody('.tabbar__tabs')).toMatch(/min-width:\s*0/)+ expect(ruleBody('.tab__add')).toMatch(/flex-shrink:\s*0/)+ })+})