Give terminal panes the height of their box

With no height of its own the embedded terminal starts at 24 rows and
can't shrink. In a shorter box the program was told 24 rows and drew the
bottom ones out of sight, losing vim's status and command lines. Let it
shrink, so its size is always the box's.
This commit is contained in:
callumalpass committed 2026-11-04 08:03:16 +11:00
1 parent 2845b6fe2b
commit 44bfa6e740
2 files changed
+19

No files matched your search

+17
View File
@@ -354,6 +354,23 @@ describe("terminal drawer", () => {
expect(app.frame()).toContain("from the editor");
expect(app.hints()).toStartWith("enter send");
});
test("$EDITOR's terminal is the size of the box it's in, even a box shorter than 24 rows", async () => {
// It writes its size on its top and bottom rows, and again when that changes.
setEditor(`draw() { printf '\\033[2J\\033[1;1Htop %s\\033[999;1Hbottom %s' "$(stty size)" "$(stty size)"; }; trap draw WINCH; draw; for i in $(seq 50); do sleep 0.1; done #`);
const app = await open({ width: 100, height: 20 });
await app.press("i");
await app.press("g", { ctrl: true });
await waitFor(() => app.frame().includes("bottom "));
const rows = app.find("bottom ").y - app.find("top ").y + 1;
expect(app.frame()).toContain(`bottom ${rows} `);
// Zoomed, it gets the taller box.
await prefix(app, "z");
await waitFor(() => !app.frame().includes(`bottom ${rows} `));
const zoomed = app.find("bottom ").y - app.find("top ").y + 1;
expect(zoomed).toBeGreaterThan(rows);
expect(app.frame()).toContain(`bottom ${zoomed} `);
});
});
describe("the panes together", () => {