Count the drawer's edge row, let the drawer shrink in the conversation's place, and name clicked files from the workspace

This commit is contained in:
Callum Alpass committed 2026-11-03 08:41:59 +11:00
1 parent 0d7a5cc051
commit 2e531df11b
4 files changed
+44 -6

No files matched your search

+3 -3
View File
@@ -63,7 +63,7 @@ describe("links and paths in replies", () => {
expect(opened()).toEqual(["https://example.com/docs", "https://bare.example.org/x"]);
});
test("a click on a workspace file's path opens it in the editor pane", async () => {
test("a click on a workspace file's path opens it in the column's editor, named from the workspace", async () => {
delete process.env.VISUAL;
process.env.EDITOR = "sleep 3; :";
const { snapshot } = workspace();
@@ -73,8 +73,8 @@ describe("links and paths in replies", () => {
expect(app.frame()).not.toContain("Editing");
const path = app.find("a.ts:3");
await app.click(path.x, path.y);
expect(app.frame()).toContain("Editing ");
expect(app.frame()).toContain("src/a.ts");
expect(app.frame()).toContain("Details Editor");
expect(app.frame()).toContain("Editing src/a.ts ");
});
test("a drag over a link selects it rather than opening it", async () => {
+26
View File
@@ -230,4 +230,30 @@ describe("editing a changed file", () => {
restoreEditor(previous);
}
});
test("on a narrow window the column, editor and all, takes the conversation's place", async () => {
const root = mkdtempSync(join(tmpdir(), "t3tui-edit-"));
writeFileSync(join(root, "README.md"), "hello\n");
const project = { ...v2ShellSnapshot.projects[0]!, workspaceRoot: root };
const previous = { visual: process.env.VISUAL, editor: process.env.EDITOR };
delete process.env.VISUAL;
process.env.EDITOR = "sleep 3; true";
try {
const app = await open({ width: 100, session: fakeSession({ vcs, snapshot: { ...v2ShellSnapshot, projects: [project] }, projection: withReply("The reply under the column.", false) }) });
await app.press("d");
await app.press("l");
await app.press("o");
expect(app.find("Editing README.md").x).toBeLessThan(50);
expect(app.frame()).not.toContain("The reply under");
expect(app.frame()).toContain("Press i to type");
// d hides the column, editor and all, and brings it back with the editor still running.
await app.press("\\", { ctrl: true });
await app.press("d");
expect(app.frame()).toContain("The reply under");
await app.press("d");
expect(app.frame()).toContain("Editing README.md");
} finally {
restoreEditor(previous);
}
});
});
+9
View File
@@ -1,6 +1,7 @@
import { describe, expect, test } from "bun:test";
import { cycleConfig, DEFAULT_CONFIG, formatClock, parseConfig } from "../src/config.ts";
import { DEFAULT_LAYOUT, parseLayout } from "../src/layout.ts";
import { settingRows } from "../src/model/settings.ts";
describe("config", () => {
@@ -32,3 +33,11 @@ describe("config", () => {
expect(rows[0]?.value).toBe("queues");
});
});
describe("layout", () => {
test("keeps the drawer's height and where terminals go, and defaults the rest", () => {
expect(parseLayout({ drawerHeight: 14, terminalPlacement: "side" })).toEqual({ ...DEFAULT_LAYOUT, drawerHeight: 14, terminalPlacement: "side" });
expect(parseLayout({ drawerHeight: -3, terminalPlacement: "left" })).toEqual(DEFAULT_LAYOUT);
expect(parseLayout(null)).toEqual(DEFAULT_LAYOUT);
});
});