diff --git a/packages/tui/src/routes/session/dialog-execute.tsx b/packages/tui/src/routes/session/dialog-execute.tsx index ea324f75c1a..8062a47f9e8 100644 --- a/packages/tui/src/routes/session/dialog-execute.tsx +++ b/packages/tui/src/routes/session/dialog-execute.tsx @@ -123,6 +123,7 @@ export function DialogExecute(props: { part: SessionMessageAssistantTool }) { } footer={{ actions: { primary: copyActions() } }} + footerGap={0} legacyFooter={ , ) { const inset = () => props.inset ?? DIALOG_INSET const newDesigns = useNewDesigns() + const footerGap = () => (newDesigns() && props.footer && props.buttons === undefined ? (props.footerGap ?? 1) : 1) return ( {props.header} - {props.children} + + {props.children} + diff --git a/packages/tui/test/ui/dialog-layout.test.tsx b/packages/tui/test/ui/dialog-layout.test.tsx new file mode 100644 index 00000000000..0e96805b09d --- /dev/null +++ b/packages/tui/test/ui/dialog-layout.test.tsx @@ -0,0 +1,56 @@ +/** @jsxImportSource @opentui/solid */ +import { testRender } from "@opentui/solid" +import { expect, test } from "bun:test" +import { ConfigProvider } from "../../src/config" +import { Keymap } from "../../src/context/keymap" +import { ThemeProvider } from "../../src/context/theme" +import { DialogBleed, DialogHeader, DialogLayout, DialogProvider } from "../../src/ui/dialog" +import { ToastProvider } from "../../src/ui/toast" +import { emptyThemeSource, tmpdir } from "../fixture/fixture" +import { TestTuiContexts } from "../fixture/tui-environment" +import { createTuiResolvedConfig } from "../fixture/tui-runtime" + +test.each([ + [undefined, 1], + [0, 0], + [2, 2], +])("footerGap %p leaves %p blank rows between the body and the footer", async (footerGap, blank) => { + await using temporary = await tmpdir() + const app = await testRender( + () => ( + + + + + + + } + footer={{ actions: { primary: [{ title: "copy", key: "c" }] } }} + footerGap={footerGap} + > + + BODY + + + + + + + + + ), + { width: 60, height: 16 }, + ) + try { + app.renderer.start() + await app.waitForFrame((frame) => frame.includes("BODY") && frame.includes("copy c")) + const lines = app.captureCharFrame().split("\n") + const body = lines.findIndex((line) => line.includes("BODY")) + const footer = lines.findIndex((line) => line.includes("copy c")) + // The footer band has one row of top padding. + expect(footer - body - 2).toBe(blank) + } finally { + app.renderer.destroy() + } +})