xonecas.io
64875
Mc

mini-coder / commit ff4568f

fix: restore two-step escape interrupt flow

xonecas2026-04-10 ff4568f4738ef54801a8d0ca95a24462c033dc30 parent 14ef2a1

4 files changed

src/ui.test.ts+22−0
@@ -1559,6 +1559,28 @@ describe("ui rendering", () => {
15591559 }
15601560 });
15611561
1562+ test("Escape while running blurs the input first and a second Escape aborts", () => {
1563+ const state = createTestState();
1564+ state.running = true;
1565+ state.abortController = new AbortController();
1566+
1567+ try {
1568+ const controller = createInputController(state);
1569+ const base = expectVStack(renderBaseLayout(state, 80, controller));
1570+
1571+ controller.onBlur();
1572+
1573+ const input = expectTextInput(renderInputArea(state.theme, controller));
1574+ expect(input.props.focused).toBe(false);
1575+ expect(state.abortController.signal.aborted).toBe(false);
1576+
1577+ base.props.onKeyPress?.("escape");
1578+ expect(state.abortController.signal.aborted).toBe(true);
1579+ } finally {
1580+ state.db.close();
1581+ }
1582+ });
1583+
15621584 test("Tab autocompletes the last file path in normal input mode", () => {
15631585 const state = createTestState();
15641586 const cwd = createTempDir();
src/ui.ts+1−3
@@ -324,9 +324,7 @@ export function createInputController(state: AppState): InputController {
324324 cel.render();
325325 },
326326 onBlur: () => {
327- if (!state.running) {
328- inputFocused = false;
329- }
327+ inputFocused = false;
330328 cel.render();
331329 },
332330 onKeyPress: (key) => {
src/ui/help.test.ts+18−0
@@ -23,4 +23,22 @@ describe("ui/help", () => {
2323 "/verbose Toggle verbose tool rendering (currently off)",
2424 );
2525 });
26+
27+ test("buildHelpText includes the current Escape input-focus note", () => {
28+ const helpState: HelpRenderState = {
29+ providers: new Map(),
30+ model: null,
31+ agentsMd: [],
32+ skills: [],
33+ plugins: [],
34+ showReasoning: DEFAULT_SHOW_REASONING,
35+ verbose: false,
36+ };
37+
38+ const text = buildHelpText(helpState);
39+
40+ expect(text).toContain("Escape blurs the input first");
41+ expect(text).toContain("Tab re-focuses the input");
42+ expect(text).toContain("Escape again interrupts the current turn");
43+ });
2644 });
src/ui/help.ts+6−0
@@ -77,6 +77,12 @@ export function buildHelpText(state: HelpRenderState): string {
7777 }
7878
7979 const providerNames = Array.from(state.providers.keys());
80+ lines.push("");
81+ lines.push("Note:");
82+ lines.push(" While a turn is running, Escape blurs the input first.");
83+ lines.push(" Tab re-focuses the input.");
84+ lines.push(" Escape again interrupts the current turn.");
85+
8086 lines.push("");
8187 lines.push(
8288 providerNames.length > 0