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(chat): let the ⌘M composer grow with the draft, and resize it by its top edge
Paul Robertsonac7dd756be4d
diff --git a/CLAUDE.md b/CLAUDE.mdindex a2bfbe969..c21d9f06d 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -4594,6 +4594,13 @@ command-bearing opens; this does not add a human-confirm dialog or change mobileterminal equivalent. Surfaces: Desktop + Server Edition identical (dictation and uploads alreadybridge — `files.saveUpload`, `speech.*`); SSH nodes upload to the host; kanban card modal sharesChatPanel and wires both props; relay tabs keep the panel's existing refusal; mobile N/A.+ **Its height** (`lib/chatComposerHeight.ts`): the textarea grows with the draft until the whole+ composer fills half the INNER space (top of `.term-chat__thread` to the bottom of the composer,+ never the whole panel), or keeps the height the user dragged the grip on its top edge to+ (localStorage, one value for every composer; double-click / Enter on the grip = auto again). The+ `/` and `@` menu takes at most 240px, half the inner space and the room above the composer+ (`completeMenuMax` → `--chat-complete-max`), so a tall box cannot push it under the panel header.+ Heights are layout pixels: a drag divides by the canvas zoom.Fix-round rules (same day): the composer is its OWN component (`nodes/ChatComposer.tsx`) so thethread and the composer restyle independently. A label click is an explicit "go to theterminal", so the flip FOCUSES the xterm whatever its entry state wasdiff --git a/src/renderer/lib/chatComposerHeight.test.ts b/src/renderer/lib/chatComposerHeight.test.tsnew file mode 100644index 000000000..7543378be--- /dev/null+++ b/src/renderer/lib/chatComposerHeight.test.ts@@ -0,0 +1,72 @@+import { describe, expect, it } from 'vitest'+import {+ COMPLETE_MENU_MAX_PX,+ THREAD_RESERVE_PX,+ completeMenuMax,+ composerHeight,+ parseComposerHeight+} from './chatComposerHeight'++const base = { content: 40, min: 40, inner: 800, chrome: 50, set: null }++describe('composerHeight', () => {+ it('keeps the two-row minimum for a short draft', () => {+ expect(composerHeight(base)).toBe(40)+ })++ it('grows with the draft', () => {+ expect(composerHeight({ ...base, content: 300 })).toBe(300)+ })++ it('stops growing by itself once the whole composer fills half the inner space', () => {+ expect(composerHeight({ ...base, content: 1000 })).toBe(400 - 50)+ })++ it('keeps a set height whatever the draft holds', () => {+ expect(composerHeight({ ...base, content: 40, set: 250 })).toBe(250)+ expect(composerHeight({ ...base, content: 1000, set: 250 })).toBe(250)+ })++ it('lets a set height go past half the inner space, but keeps room for the thread', () => {+ expect(composerHeight({ ...base, set: 600 })).toBe(600)+ expect(composerHeight({ ...base, set: 5000 })).toBe(800 - 50 - THREAD_RESERVE_PX)+ })++ it('never sets less than the two-row minimum', () => {+ expect(composerHeight({ ...base, set: 5 })).toBe(40)+ expect(composerHeight({ ...base, inner: 100, content: 300 })).toBe(40)+ })++ it('has no upper bound while the panel has no box', () => {+ expect(composerHeight({ ...base, inner: 0, content: 1000 })).toBe(1000)+ })+})++describe('completeMenuMax', () => {+ it('keeps its own ceiling in a tall panel', () => {+ expect(completeMenuMax({ inner: 800, composer: 100 })).toBe(COMPLETE_MENU_MAX_PX)+ })++ it('takes at most half the inner space', () => {+ expect(completeMenuMax({ inner: 300, composer: 90 })).toBe(150)+ })++ it('fits in the room above a composer set taller than half', () => {+ expect(completeMenuMax({ inner: 400, composer: 300 })).toBe(104)+ })++ it('never goes negative, and leaves the stylesheet in charge with no box', () => {+ expect(completeMenuMax({ inner: 200, composer: 400 })).toBe(0)+ expect(completeMenuMax({ inner: 0, composer: 90 })).toBeNull()+ })+})++describe('parseComposerHeight', () => {+ it('reads a stored height', () => {+ expect(parseComposerHeight('320')).toBe(320)+ })++ it('reads anything else as auto', () => {+ for (const raw of [null, '', '0', '-5', '12.5', 'tall', '999999']) expect(parseComposerHeight(raw)).toBeNull()+ })+})diff --git a/src/renderer/lib/chatComposerHeight.ts b/src/renderer/lib/chatComposerHeight.tsnew file mode 100644index 000000000..507c1715c--- /dev/null+++ b/src/renderer/lib/chatComposerHeight.ts@@ -0,0 +1,77 @@+import { readLocal, writeLocal } from './localStore'++// The ⌘M composer's textarea height. Two modes:+// - AUTO (no stored height): the box grows with the draft, from its two-row minimum until the+// composer (box and toolbar) fills half the INNER space, then scrolls.+// - SET (the user dragged the grip on the box's top edge): the box keeps that height whatever the+// draft holds. A double-click on the grip goes back to auto.+// Either way the box never takes so much of the panel that the thread disappears.+//+// INNER space = the thread plus the composer: the panel minus its header bar (and the fallback note+// when there is one). The `/` and `@` menu opens above the composer, over the thread, and is sized+// against the same space so the two together never run past it (`completeMenuMax`).+//+// PERSONAL: one height for every composer, in localStorage (the view-state tier, like the canvas+// lock), never settings.json or the git-shared project file. Heights are LAYOUT pixels (unscaled by+// the canvas zoom).++export const CHAT_COMPOSER_HEIGHT_KEY = 'nodeterm.chatComposerHeight'++/** Share of the inner space the composer may grow to by itself, and the menu may take. */+export const INNER_SHARE = 0.5+/** Inner height kept for the thread however tall the box is set. */+export const THREAD_RESERVE_PX = 96+/** The completion menu's own ceiling (it was a fixed max-height before it followed the space). */+export const COMPLETE_MENU_MAX_PX = 240+/** How far the menu overlaps the composer's top edge (`.term-chat__complete`'s `bottom`). */+export const COMPLETE_MENU_OVERLAP_PX = 4+/** One step of the grip's arrow keys. */+export const KEYBOARD_STEP_PX = 24++/** A stored height: a positive whole number, else none (auto). */+export function parseComposerHeight(raw: string | null): number | null {+ if (raw === null || !/^\d{1,5}$/.test(raw)) return null+ const n = Number(raw)+ return n > 0 ? n : null+}++export function readComposerHeight(): number | null {+ return parseComposerHeight(readLocal(CHAT_COMPOSER_HEIGHT_KEY))+}++export function writeComposerHeight(height: number | null): void {+ writeLocal(CHAT_COMPOSER_HEIGHT_KEY, height === null ? '' : String(Math.round(height)))+}++export interface ComposerHeightInput {+ /** The textarea's height for its draft (its scrollHeight). */+ content: number+ /** The textarea's two-row height. */+ min: number+ /** The inner space (thread + composer); 0 or less while the panel has no box (a collapsed node). */+ inner: number+ /** The composer's height outside the textarea (toolbar, padding). */+ chrome: number+ /** The height the user set, or null for auto. */+ set: number | null+}++/** The textarea's height. */+export function composerHeight({ content, min, inner, chrome, set }: ComposerHeightInput): number {+ // No box to measure against: no upper bound, so the draft is not squeezed to nothing.+ const room = inner > 0 ? Math.max(min, inner - chrome - THREAD_RESERVE_PX) : Number.POSITIVE_INFINITY+ if (set !== null) return Math.round(Math.min(room, Math.max(min, set)))+ const autoMax = inner > 0 ? Math.max(min, inner * INNER_SHARE - chrome) : Number.POSITIVE_INFINITY+ return Math.round(Math.min(room, autoMax, Math.max(min, content)))+}++/**+ * The completion menu's max-height: its own ceiling, half the inner space, and never more than the+ * room above the composer — a box set taller than half would otherwise push the menu's top under the+ * panel's header. Null while the panel has no box (the stylesheet's ceiling applies).+ */+export function completeMenuMax({ inner, composer }: { inner: number; composer: number }): number | null {+ if (inner <= 0) return null+ const above = inner - composer + COMPLETE_MENU_OVERLAP_PX+ return Math.max(0, Math.floor(Math.min(COMPLETE_MENU_MAX_PX, inner * INNER_SHARE, above)))+}diff --git a/src/renderer/nodes/ChatComposer.resize.test.tsx b/src/renderer/nodes/ChatComposer.resize.test.tsxnew file mode 100644index 000000000..7bc0e9566--- /dev/null+++ b/src/renderer/nodes/ChatComposer.resize.test.tsx@@ -0,0 +1,203 @@+// @vitest-environment jsdom+import { act, useState } from 'react'+import { createRoot, type Root } from 'react-dom/client'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { CHAT_COMPOSER_HEIGHT_KEY } from '../lib/chatComposerHeight'++/**+ * The ⌘M composer's height against the REAL component: the box grows with the draft until the+ * composer fills half the inner space, the grip on its top edge sets a height that sticks (and is+ * remembered), a double-click hands it back to the draft, and the `/` menu fits above it. jsdom lays+ * nothing out, so the geometry the component reads is stubbed: a two-row textarea is 40px, the+ * composer around it adds 50px, and the inner space (thread + composer) is 760px under a 40px bar.+ */++;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true++const { api } = vi.hoisted(() => ({+ api: {+ pty: { sendText: vi.fn(async () => true as const) },+ chat: { catalog: vi.fn(async () => ({ version: 1, entries: [] })) },+ files: { quickOpen: vi.fn(async () => []) }+ }+}))+vi.mock('../session/session', () => ({ useSession: () => ({ api }) }))++import { ChatComposer } from './ChatComposer'++let host: HTMLDivElement+let root: Root+/** The draft's natural height (what scrollHeight answers). */+let content = 40+/** Screen pixels per layout pixel (the canvas zoom). */+let zoom = 1+/** Keys that reached the panel's own key handler (ChatPanel's `onPanelKey`). */+let panelKeys: string[] = []++function Harness() {+ const [value, setValue] = useState('')+ return (+ <div className="term-chat" onKeyDown={(e) => panelKeys.push(e.key)}>+ <div className="term-chat__thread" />+ <ChatComposer+ nodeId="n1"+ agentId="claude"+ agentLabel="Agent"+ value={value}+ onChange={setValue}+ onSend={() => {}}+ placeholder="Message"+ disabled={false}+ onWriteRefused={() => {}}+ />+ </div>+ )+}++const ta = () => host.querySelector('textarea') as HTMLTextAreaElement+const grip = () => host.querySelector('.term-chat__composer-grip') as HTMLDivElement+const stored = () => localStorage.getItem(CHAT_COMPOSER_HEIGHT_KEY)+const menuMax = () =>+ (host.querySelector('.term-chat__compose') as HTMLDivElement).style.getPropertyValue('--chat-complete-max')++function stubGeometry(): void {+ const el = ta()+ const height = () => (el.style.height === '' || el.style.height === 'auto' ? 40 : parseFloat(el.style.height))+ Object.defineProperty(el, 'offsetHeight', { configurable: true, get: height })+ Object.defineProperty(el, 'scrollHeight', { configurable: true, get: () => Math.max(40, content) })+ el.getBoundingClientRect = () => ({ height: height() * zoom }) as DOMRect+ const compose = host.querySelector('.term-chat__compose') as HTMLDivElement+ Object.defineProperty(compose, 'offsetHeight', { configurable: true, get: () => height() + 50 })+ // The composer sits at the bottom of an 800px panel; the thread starts under a 40px bar.+ Object.defineProperty(compose, 'offsetTop', { configurable: true, get: () => 800 - (height() + 50) })+ const thread = host.querySelector('.term-chat__thread') as HTMLDivElement+ Object.defineProperty(thread, 'offsetTop', { configurable: true, get: () => 40 })+ grip().setPointerCapture = () => {}+}++async function mount(): Promise<void> {+ await act(async () => root.render(<Harness />))+ stubGeometry()+}++async function type(text: string, height: number): Promise<void> {+ content = height+ const el = ta()+ const setter = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value')!.set!+ await act(async () => {+ setter.call(el, text)+ el.dispatchEvent(new Event('input', { bubbles: true }))+ })+}++function pointer(type: string, clientY: number): Event {+ const e = new MouseEvent(type, { bubbles: true, cancelable: true, clientY, button: 0 })+ Object.defineProperty(e, 'pointerId', { value: 1 })+ return e+}++async function drag(fromY: number, toY: number): Promise<void> {+ await act(async () => {+ grip().dispatchEvent(pointer('pointerdown', fromY))+ grip().dispatchEvent(pointer('pointermove', (fromY + toY) / 2))+ grip().dispatchEvent(pointer('pointermove', toY))+ grip().dispatchEvent(pointer('pointerup', toY))+ })+}++beforeEach(() => {+ localStorage.removeItem(CHAT_COMPOSER_HEIGHT_KEY)+ content = 40+ zoom = 1+ panelKeys = []+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+})+afterEach(async () => {+ await act(async () => root.unmount())+ host.remove()+})++describe('ChatComposer height', () => {+ it('grows with the draft, until the composer fills half the inner space', async () => {+ await mount()++ await type('a long prompt', 300)+ const grown = ta().style.height+ await type('a much longer prompt', 1000)++ expect(grown).toBe('300px')+ expect(ta().style.height).toBe(`${760 / 2 - 50}px`)+ })++ it('keeps the menu at its own ceiling while there is room above the composer', async () => {+ await mount()++ await type('/', 40)++ expect(menuMax()).toBe('240px')+ })++ it('shrinks the menu to the room above a composer set tall', async () => {+ await mount()++ await drag(700, 140)++ expect(ta().style.height).toBe('600px')+ expect(menuMax()).toBe(`${760 - 650 + 4}px`)+ })++ it('keeps the height the grip was dragged to, and remembers it', async () => {+ await mount()++ await drag(500, 200)+ await type('short', 40)++ expect(ta().style.height).toBe('340px')+ expect(stored()).toBe('340')+ })++ it('reads a drag in layout pixels when the canvas is zoomed', async () => {+ zoom = 2+ await mount()++ await drag(500, 300)++ expect(ta().style.height).toBe('140px')+ })++ it('opens at the remembered height', async () => {+ localStorage.setItem(CHAT_COMPOSER_HEIGHT_KEY, '250')++ await mount()+ await type('x', 40)++ expect(ta().style.height).toBe('250px')+ })++ it('grows with the draft again after a double-click on the grip', async () => {+ await mount()+ await drag(500, 200)++ await act(async () => {+ grip().dispatchEvent(new MouseEvent('dblclick', { bubbles: true }))+ })+ await type('a long prompt', 300)++ expect(ta().style.height).toBe('300px')+ expect(stored()).toBe('')+ })++ it('steps with the arrow keys on the grip', async () => {+ await mount()++ await act(async () => {+ grip().dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowUp', bubbles: true, cancelable: true }))+ })++ expect(ta().style.height).toBe('64px')+ expect(stored()).toBe('64')+ expect(panelKeys).toEqual([])+ })+})diff --git a/src/renderer/nodes/ChatComposer.tsx b/src/renderer/nodes/ChatComposer.tsxindex f9c3092f8..5c9da2128 100644--- a/src/renderer/nodes/ChatComposer.tsx+++ b/src/renderer/nodes/ChatComposer.tsx@@ -11,6 +11,7 @@ import {type Dispatch,type DragEvent as ReactDragEvent,type KeyboardEvent,+ type PointerEvent as ReactPointerEvent,type SetStateAction} from 'react'import { useAgentStatus } from '../state/agentStatus'@@ -27,6 +28,13 @@ import { Spinner } from '../components/Spinner'import { builtinSlashCommands, sanitizeChatCatalog, type ChatCatalogEntry } from '@shared/chat-catalog'import { prepareQuickOpenFiles, type QuickOpenIndexedFile } from '../lib/quickOpenSearch'import { commandSegments, mentionsSlashToken } from '../lib/chatComposerHighlight'+import {+ KEYBOARD_STEP_PX,+ completeMenuMax,+ composerHeight,+ readComposerHeight,+ writeComposerHeight+} from '../lib/chatComposerHeight'import {CATALOG_REUSE_MS,applyCompletion,@@ -230,6 +238,128 @@ export function ChatComposer({hl.scrollTop = ta.scrollTop}, [])useLayoutEffect(syncHighlightScroll, [segments, syncHighlightScroll])++ // The textarea's height (lib/chatComposerHeight.ts): it grows with the draft, or keeps the height+ // the user dragged the grip to. Set by hand, never through a style prop: the auto-grow has to+ // measure the draft at the textarea's natural height first.+ const composeRef = useRef<HTMLDivElement>(null)+ const [setHeight, setSetHeight] = useState<number | null>(readComposerHeight)+ /** The `/` and `@` menu's max-height follows the room above the composer (a custom property on+ * the composer root, read by `.term-chat__complete`), so it never runs under the panel header. */+ const sizeCompleteMenu = useCallback((inner: number, composer: number) => {+ const max = completeMenuMax({ inner, composer })+ const el = composeRef.current+ if (el === null) return+ if (max === null) el.style.removeProperty('--chat-complete-max')+ else el.style.setProperty('--chat-complete-max', `${max}px`)+ }, [])+ /** The bounds to size against, measured with the textarea at its natural (two-row) height. Null+ * while it has no box (a collapsed node): there is nothing to measure. */+ const measureInput = useCallback(() => {+ const ta = inputRef.current+ if (ta === null) return null+ const top = ta.scrollTop+ ta.style.height = 'auto'+ const min = ta.offsetHeight+ if (min === 0) {+ ta.style.height = ''+ return null+ }+ // Inner space: from the top of the thread to the bottom of the composer (both children of the+ // panel). The thread flexes, so this does not change with the textarea's height.+ const compose = composeRef.current+ const thread = ta.closest('.term-chat')?.querySelector<HTMLElement>(':scope > .term-chat__thread')+ const inner =+ compose === null || thread === null || thread === undefined+ ? 0+ : compose.offsetTop + compose.offsetHeight - thread.offsetTop+ const chrome = (compose?.offsetHeight ?? min) - min+ return { ta, top, min, content: ta.scrollHeight, inner, chrome }+ }, [])+ const fitInput = useCallback(() => {+ const m = measureInput()+ if (m === null) return+ const height = composerHeight({ ...m, set: setHeight })+ m.ta.style.height = `${height}px`+ sizeCompleteMenu(m.inner, height + m.chrome)+ // Collapsing to the natural height for the measurement moved the scroll; put it back.+ m.ta.scrollTop = m.top+ syncHighlightScroll()+ }, [measureInput, setHeight, sizeCompleteMenu, syncHighlightScroll])+ useLayoutEffect(fitInput, [value, fitInput])+ // A resized panel (node resize, a collapsed node expanded) changes the bounds.+ useEffect(() => {+ const panel = inputRef.current?.closest('.term-chat')+ if (panel === null || panel === undefined || typeof ResizeObserver === 'undefined') return+ const ro = new ResizeObserver(() => fitInput())+ ro.observe(panel)+ return () => ro.disconnect()+ }, [fitInput])+ /** Sets the height to `target` (clamped as it will be drawn) and, when `save`, remembers it. */+ const resizeInput = (target: number | null, save: boolean) => {+ if (target === null) {+ setSetHeight(null)+ if (save) writeComposerHeight(null)+ return+ }+ const m = measureInput()+ const next = m === null ? Math.round(target) : composerHeight({ ...m, set: target })+ if (m !== null) {+ m.ta.style.height = `${next}px`+ sizeCompleteMenu(m.inner, next + m.chrome)+ }+ setSetHeight(next)+ if (save) writeComposerHeight(next)+ }+ const dragRef = useRef<{ pointerId: number; startY: number; startHeight: number; scale: number } | null>(null)+ const onGripPointerDown = (e: ReactPointerEvent<HTMLDivElement>) => {+ const ta = inputRef.current+ if (e.button !== 0 || ta === null) return+ // The canvas zoom scales the node: a screen pixel of pointer travel is not a layout pixel.+ const scale = ta.offsetHeight > 0 ? ta.getBoundingClientRect().height / ta.offsetHeight : 1+ dragRef.current = {+ pointerId: e.pointerId,+ startY: e.clientY,+ startHeight: ta.offsetHeight,+ scale: scale > 0 ? scale : 1+ }+ e.currentTarget.setPointerCapture(e.pointerId)+ }+ const onGripPointerMove = (e: ReactPointerEvent<HTMLDivElement>) => {+ const d = dragRef.current+ if (d === null || d.pointerId !== e.pointerId) return+ // The grip is on the TOP edge: dragging up makes the box taller.+ resizeInput(d.startHeight + (d.startY - e.clientY) / d.scale, false)+ }+ const onGripPointerEnd = (e: ReactPointerEvent<HTMLDivElement>) => {+ const d = dragRef.current+ if (d === null || d.pointerId !== e.pointerId) return+ dragRef.current = null+ resizeInput(d.startHeight + (d.startY - e.clientY) / d.scale, true)+ }+ // A cancelled drag (the system took the pointer) keeps the height it reached: a cancel event's+ // coordinates are not a position the user chose.+ const onGripPointerCancel = (e: ReactPointerEvent<HTMLDivElement>) => {+ const d = dragRef.current+ if (d === null || d.pointerId !== e.pointerId) return+ dragRef.current = null+ const ta = inputRef.current+ if (ta !== null && ta.offsetHeight > 0) resizeInput(ta.offsetHeight, true)+ }+ const onGripKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {+ const ta = inputRef.current+ if (ta === null) return+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {+ e.preventDefault()+ e.stopPropagation()+ const step = e.key === 'ArrowUp' ? KEYBOARD_STEP_PX : -KEYBOARD_STEP_PX+ resizeInput(ta.offsetHeight + step, true)+ } else if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault()+ e.stopPropagation()+ resizeInput(null, true)+ }+ }// A composer that cannot flip to the terminal (no `onShowTerminal`) does not offer a built-in that// opens a dialog there: the dialog would be invisible and the next Enter would answer it.const offered = onShowTerminal ? catalog : catalog.filter((e) => !e.interactive)@@ -477,7 +607,7 @@ export function ChatComposer({const labelDisabled = disabled || agentBusy || pickerBusy || sendUnconfirmedreturn (- <div className="term-chat__compose">+ <div ref={composeRef} className="term-chat__compose">{menuOpen && (<divref={menuRef}@@ -529,6 +659,26 @@ export function ChatComposer({onDragLeave={onDragLeave}onDrop={onDrop}>+ <div+ className="term-chat__composer-grip"+ role="separator"+ aria-orientation="horizontal"+ aria-label="Resize the message box"+ title={+ setHeight === null+ ? 'Drag to resize the message box'+ : 'Drag to resize the message box. Double-click to let it grow with your text again.'+ }+ tabIndex={0}+ // Keep the caret in the textarea, and start no text selection.+ onMouseDown={(e) => e.preventDefault()}+ onPointerDown={onGripPointerDown}+ onPointerMove={onGripPointerMove}+ onPointerUp={onGripPointerEnd}+ onPointerCancel={onGripPointerCancel}+ onDoubleClick={() => resizeInput(null, true)}+ onKeyDown={onGripKeyDown}+ /><div className="term-chat__composer-field">{segments !== null && (<div ref={highlightRef} className="term-chat__composer-highlight" aria-hidden="true">diff --git a/src/renderer/nodes/ChatPanel.tsx b/src/renderer/nodes/ChatPanel.tsxindex 699200704..309cb5538 100644--- a/src/renderer/nodes/ChatPanel.tsx+++ b/src/renderer/nodes/ChatPanel.tsx@@ -885,20 +885,21 @@ export function ChatPanel({}, [maybeLoadOlder])// The panel's box changing size — above all a collapsed node being EXPANDED (display:none → a- // real box). Nothing else re-runs the checks then: while hidden, follow and anchor had zero- // geometry to work with and paging was refused. So: a user who was following lands at the- // bottom, and paging resumes (a short thread fetches older right away). Guarded: jsdom and old- // engines have no ResizeObserver, and the panel works without it.+ // real box), and the composer growing or being resized under it. Nothing else re-runs the checks+ // then: while hidden, follow and anchor had zero geometry to work with and paging was refused. So:+ // a user who was following stays at the bottom, and paging resumes (a short thread fetches older+ // right away). Guarded: jsdom and old engines have no ResizeObserver, and the panel works without+ // it.const maybeLoadOlderRef = useRef(maybeLoadOlder)maybeLoadOlderRef.current = maybeLoadOlderuseEffect(() => {const el = msgsRef.currentif (!el || typeof ResizeObserver === 'undefined') return- let hadBox = el.clientHeight > 0+ let lastHeight = el.clientHeightconst ro = new ResizeObserver(() => {- const hasBox = el.clientHeight > 0- if (hasBox && !hadBox && nearBottomRef.current) el.scrollTop = el.scrollHeight- hadBox = hasBox+ const height = el.clientHeight+ if (height > 0 && height !== lastHeight && nearBottomRef.current) el.scrollTop = el.scrollHeight+ lastHeight = heightmaybeLoadOlderRef.current()attemptLiveRef.current() // a hook event held while the panel was hidden})diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 5d8de15f9..eba6df313 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -4011,14 +4011,16 @@ body,border-top: 1px solid rgba(var(--tint-rgb), 0.08);}/* The composer's `/` and `@` completion menu (ChatComposer), floating ABOVE the composer box. A solid- token, not a glass fill: it sits inside a glass node, which is a backdrop root (Liquid Glass). */+ token, not a glass fill: it sits inside a glass node, which is a backdrop root (Liquid Glass).+ `--chat-complete-max` is set by the composer to the room above it (lib/chatComposerHeight.ts+ `completeMenuMax`), so a tall composer in a short panel cannot push the menu under the header. */.term-chat__complete {position: absolute;left: 8px;right: 8px;bottom: calc(100% - 4px);z-index: 8;- max-height: 240px;+ max-height: min(240px, var(--chat-complete-max, 240px));overflow-y: auto;padding: 4px;background: var(--panel);@@ -4066,6 +4068,7 @@ body,compact toolbar under it — "+" attach on the left; model label, muted effort label and the micon the right. The focus ring belongs to the BOX, so the textarea itself draws no border. */.term-chat__composer {+ position: relative;display: flex;flex-direction: column;gap: 2px;@@ -4078,6 +4081,45 @@ body,.term-chat__composer:focus-within {border-color: var(--accent);}+/* The grip on the composer box's top edge: drag it up or down to set the message box's height,+ double-click to let it grow with the draft again (ChatComposer, lib/chatComposerHeight.ts). The+ hit area straddles the border; the visible pill shows while the pointer is over the box. */+.term-chat__composer-grip {+ position: absolute;+ top: -6px;+ left: 24px;+ right: 24px;+ height: 12px;+ z-index: 1;+ cursor: ns-resize;+ touch-action: none;+}+.term-chat__composer-grip::after {+ content: '';+ position: absolute;+ top: 4px;+ left: 50%;+ width: 36px;+ height: 4px;+ margin-left: -18px;+ border-radius: 2px;+ background: rgba(var(--tint-rgb), 0.35);+ opacity: 0;+ transition: opacity 0.12s ease;+}+.term-chat__composer:hover .term-chat__composer-grip::after,+.term-chat__composer-grip:focus-visible::after {+ opacity: 1;+}+.term-chat__composer-grip:hover::after {+ background: var(--accent);+}+.term-chat__composer-grip:focus-visible {+ outline: none;+}+.term-chat__composer-grip:focus-visible::after {+ background: var(--accent);+}.term-chat__composer--drop {border-color: var(--accent);border-style: dashed;diff --git a/src/renderer/styles.theme.test.ts b/src/renderer/styles.theme.test.tsindex 3c28d072a..d1362c463 100644--- a/src/renderer/styles.theme.test.ts+++ b/src/renderer/styles.theme.test.ts@@ -132,7 +132,8 @@ describe('every CSS variable resolves', () => {'--cmascot-h','--cmascot-sheet-w','--cmascot-sheet-h', // notch HUD sprite sheets- '--swimlane-color' // GlobalKanbanView swimlane left border, per project+ '--swimlane-color', // GlobalKanbanView swimlane left border, per project+ '--chat-complete-max' // ChatComposer, the `/` menu's room above the composer (completeMenuMax)])it('references no variable that is never defined', () => {