Put the terminal drawer below the message box

This commit is contained in:
Callum Alpass committed 2026-11-03 20:01:11 +11:00
1 parent 07f0d9b408
commit 9e532f5d6f
4 files changed
+34 -30

No files matched your search

+1 -1
View File
@@ -58,7 +58,7 @@ The keys you'll use most:
| `c` | new thread |
| `m` | model, reasoning and access mode |
| `.` | thread actions: pin, snooze, rename, archive… |
| `ctrl+j` | the thread's terminals on the server, in a drawer below the conversation (`alt+1`–`9` switch tabs) |
| `ctrl+j` | the thread's terminals on the server, in a drawer below the message box (`alt+1`–`9` switch tabs) |
| `ctrl+\` | move the keys between the terminal or editor and the conversation |
| `ctrl+g` | write the message in `$EDITOR`, in the message box's place |
| `d`, `{` / `}` | show or hide the right-hand column; switch its tabs (details, an open editor, terminals placed at the side) |
+1 -1
View File
@@ -159,7 +159,7 @@ Limits: GIF, JPEG, PNG and WebP images up to 10 MB each and 80 MB in all, other
## Terminals
`ctrl+j` opens the thread's terminal on the T3 server in a drawer between the conversation and the message box, as the app's terminal drawer does; `ctrl+j` again hides it. If the thread has none, it starts one in the thread's worktree or project folder. The drawer takes 40% of the conversation's height at first; drag its top edge to resize it (the height is kept for the next run) and right-click the edge to reset it. On a window too short to leave the conversation 10 rows, the drawer takes the conversation's place.
`ctrl+j` opens the thread's terminal on the T3 server in a drawer below the message box; `ctrl+j` again hides it. If the thread has none, it starts one in the thread's worktree or project folder. The drawer takes 40% of the conversation's height at first; drag its top edge to resize it (the height is kept for the next run) and right-click the edge to reset it. On a window too short to leave the conversation 10 rows, the drawer takes the conversation's place.
Each of the thread's terminals has a tab at the top of the drawer: click one, or press `alt+1`–`alt+9` while the drawer shows, to switch; `+` starts another. A terminal that closes or exits takes its tab away, and the last one the drawer. Each thread keeps its own drawer, so another thread shows its own terminals, and `ctrl+j` brings back the one you last had.
+29 -24
View File
@@ -162,7 +162,10 @@ export function App(props: { readonly session: T3Session; readonly config: T3tui
const [diff, setDiff] = useState<DiffState | null>(null);
/** The conversation's height, for the column when it takes that place; and the conversation's and drawer's together. */
const [contentHeight, setContentHeight] = useState(0);
const [areaHeight, setAreaHeight] = useState(0);
const [columnHeight, setColumnHeight] = useState(0);
const [belowHeight, setBelowHeight] = useState(0);
/** The conversation's rows with no drawer open: the column less the composer and what sits with it. */
const areaHeight = columnHeight - belowHeight;
const [config, setConfig] = useState(props.config);
const [settingsIndex, setSettingsIndex] = useState<number | null>(null);
const [serverConfig, setServerConfig] = useState<ServerConfigState | null>(null);
@@ -1276,8 +1279,8 @@ export function App(props: { readonly session: T3Session; readonly config: T3tui
setListWidthPref(null);
saveLayoutNow({ listWidth: null });
}} />}
<box flexDirection="column" flexGrow={1} minHeight={0}>
<box flexDirection="column" flexGrow={1} minHeight={0} onSizeChange={function (this: { height: number }) { setAreaHeight(this.height); }}>
<box flexDirection="column" flexGrow={1} minHeight={0} onSizeChange={function (this: { height: number }) { setColumnHeight(this.height); }}>
<box flexDirection="column" flexGrow={1} minHeight={0} visible={!drawerInPlace}>
<box flexDirection="column" flexGrow={1} minHeight={0} visible={!drawerInPlace} onMouseDown={focusConversation} onSizeChange={function (this: { height: number }) { setContentHeight(this.height); }}>
{conversationHidden ? null : settingsIndex !== null ? (
<SettingsView
@@ -1324,28 +1327,8 @@ export function App(props: { readonly session: T3Session; readonly config: T3tui
</box>
)}
</box>
{drawer ? (
<>
{drawerInPlace ? null : (
<ResizeHandle
horizontal
active={resizing === "drawer"}
onStart={(event) => {
drawerDrag.current = { y: event.y, height: drawerHeight };
setResizing("drawer");
}}
onReset={() => {
setDrawerHeightPref(null);
saveLayoutNow({ drawerHeight: null });
}}
/>
)}
<box flexDirection="column" minHeight={0} {...(drawerInPlace ? { flexGrow: 1, flexShrink: 1 } : { height: drawerHeight, flexShrink: 0 })}>
{terminalPane}
</box>
</>
) : null}
</box>
<box flexDirection="column" flexShrink={0} onSizeChange={function (this: { height: number }) { setBelowHeight(this.height); }}>
{workspace.note ? <text fg={workspace.setupFailed ? colors.bad : colors.muted}>{workspace.note}</text> : null}
{find.open ? <ThreadFindBar query={find.query} focused={mode === "find"} data={find.data} pending={find.pending} error={find.error} onQuery={find.onQuery} onStep={find.step} onClose={() => setMode("nav")} /> : null}
{mode !== "confirm" && secret.request ? <SecretPanel request={secret.request} value={secret.value} error={secret.error} busy={secret.busy} actions={secret.actions} /> : null}
@@ -1477,6 +1460,28 @@ export function App(props: { readonly session: T3Session; readonly config: T3tui
</box>
) : null}
</box>
{drawer ? (
<>
{drawerInPlace ? null : (
<ResizeHandle
horizontal
active={resizing === "drawer"}
onStart={(event) => {
drawerDrag.current = { y: event.y, height: drawerHeight };
setResizing("drawer");
}}
onReset={() => {
setDrawerHeightPref(null);
saveLayoutNow({ drawerHeight: null });
}}
/>
)}
<box flexDirection="column" minHeight={0} {...(drawerInPlace ? { flexGrow: 1, flexShrink: 1 } : { height: drawerHeight, flexShrink: 0 })}>
{terminalPane}
</box>
</>
) : null}
</box>
{rightColumn ? (
<ResizeHandle active={resizing === "details"} onStart={() => setResizing("details")} onReset={() => {
setDetailsWidthPref(null);
+3 -4
View File
@@ -19,17 +19,16 @@ const snapshot = { type: "snapshot", threadId: v2ThreadId, terminalId: "term-1",
const withTerminal = (events: readonly unknown[] = [snapshot]) => fakeSession({ terminals: [terminal], terminalEvents: events, projection: withReply("The reply above the drawer.", false) });
describe("terminal drawer", () => {
test("ctrl+j opens the thread's terminal in a drawer below the conversation, with its scrollback, and it takes every key", async () => {
test("ctrl+j opens the thread's terminal in a drawer below the composer, with its scrollback, and it takes every key", async () => {
const app = await open({ session: withTerminal() });
await app.press("j", { ctrl: true });
expect(app.frame()).toContain("Terminal 1 +");
expect(app.frame()).toContain("user@host:~$");
expect(app.calls("attachTerminal")).toHaveLength(1);
expect(app.hints()).toBe("ctrl+\\ leave pane");
// Between the conversation and the composer, the conversation's full width.
// Under the composer, the conversation's full width.
const tab = app.find("Terminal 1 +");
expect(tab.y).toBeGreaterThan(app.find("The reply above").y);
expect(tab.y).toBeLessThan(app.find("Press i to type").y);
expect(tab.y).toBeGreaterThan(app.find("Press i to type").y);
expect(tab.x).toBeLessThan(app.find("Press i to type").x);
await app.press("q");
await app.press("escape");