diff --git a/README.md b/README.md index 1cf2af7..6c8d9c1 100644 --- a/README.md +++ b/README.md @@ -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) | diff --git a/docs/reference.md b/docs/reference.md index b36caff..c899524 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -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. diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 0e81391..1b85d90 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -162,7 +162,10 @@ export function App(props: { readonly session: T3Session; readonly config: T3tui const [diff, setDiff] = useState(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(null); const [serverConfig, setServerConfig] = useState(null); @@ -1276,8 +1279,8 @@ export function App(props: { readonly session: T3Session; readonly config: T3tui setListWidthPref(null); saveLayoutNow({ listWidth: null }); }} />} - - + + {conversationHidden ? null : settingsIndex !== null ? ( )} - {drawer ? ( - <> - {drawerInPlace ? null : ( - { - drawerDrag.current = { y: event.y, height: drawerHeight }; - setResizing("drawer"); - }} - onReset={() => { - setDrawerHeightPref(null); - saveLayoutNow({ drawerHeight: null }); - }} - /> - )} - - {terminalPane} - - - ) : null} + {workspace.note ? {workspace.note} : null} {find.open ? setMode("nav")} /> : null} {mode !== "confirm" && secret.request ? : null} @@ -1476,6 +1459,28 @@ export function App(props: { readonly session: T3Session; readonly config: T3tui ) : null} + + {drawer ? ( + <> + {drawerInPlace ? null : ( + { + drawerDrag.current = { y: event.y, height: drawerHeight }; + setResizing("drawer"); + }} + onReset={() => { + setDrawerHeightPref(null); + saveLayoutNow({ drawerHeight: null }); + }} + /> + )} + + {terminalPane} + + + ) : null} {rightColumn ? ( setResizing("details")} onReset={() => { diff --git a/test/app/pane.test.tsx b/test/app/pane.test.tsx index 576311a..aabfa88 100644 --- a/test/app/pane.test.tsx +++ b/test/app/pane.test.tsx @@ -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");