One keymap for keys, hints, clickable hints and palette shortcuts

Each binding names its keys, its hint and its palette command once. The app
builds the bindings for the current state in hint order; the first that
takes a key runs it, the hint bar lists them and a click runs the same
action, and the palette reads its shortcuts from them. This replaces the
hand-ordered key handler, the hint strings and the parsing of hint text
back into key events.

The secret, queue and turn hooks return bindings in place of their key()
handlers and command lists.
This commit is contained in:
Callum Alpass committed 2026-11-02 22:40:50 +11:00
1 parent 87a3a79288
commit 8a0475ed63
11 files changed
+607 -502

No files matched your search

+27
View File
@@ -60,6 +60,26 @@ describe("modes and hints", () => {
});
});
describe("keys falling through", () => {
test("in the details panel, navigation keys still work", async () => {
const app = await open();
await app.press("l");
await app.press("c");
expect(app.frame()).toContain("What should the new thread do?");
});
test("the composer's / menu takes the arrows and esc; esc again leaves the composer", async () => {
const app = await open();
await app.press("i");
await app.type("/");
expect(app.hints()).toBe("↑/↓ move · tab or enter choose · esc close");
await app.press("escape");
expect(app.hints()).toStartWith("enter send");
await app.press("escape");
expect(app.hints()).toStartWith("j/k threads");
});
});
describe("palette and pickers", () => {
test("ctrl+k opens the palette, typing filters it, esc closes it", async () => {
const app = await open();
@@ -79,6 +99,13 @@ describe("palette and pickers", () => {
expect(app.frame()).toMatch(/New thread\s+c/);
});
test("palette entries for pending requests carry their keys", async () => {
const app = await open({ session: fakeSession({ projection: withApproval() }) });
await app.press("k", { ctrl: true });
await app.type("always allow");
expect(app.frame()).toMatch(/Always allow this session\s+Y/);
});
test("running a command from the palette", async () => {
const app = await open();
await app.press("k", { ctrl: true });