diff --git a/packages/coding-agent/src/modes/components/tree-selector.ts b/packages/coding-agent/src/modes/components/tree-selector.ts index c3f88d959..33a8c00cc 100644 --- a/packages/coding-agent/src/modes/components/tree-selector.ts +++ b/packages/coding-agent/src/modes/components/tree-selector.ts @@ -852,7 +852,8 @@ class TreeList implements Component { } else if ( matchesKey(keyData, "shift+enter") || matchesKey(keyData, "shift+return") || - keyData === "\n" // Shift+Enter delivered as bare LF (iTerm2 legacy mapping) — matches the composer (issue #8821) + keyData === "\n" || // Shift+Enter delivered as bare LF (iTerm2 legacy mapping) — matches the composer (issue #8821) + keyData === "\x1b[13;2~" // Shift+Enter legacy CSI ~ form — also accepted by the composer (editor.ts:1466) ) { // Summarize-and-switch: fork with a branch summary without the extra prompt. const selected = this.#filteredNodes[this.#selectedIndex]; diff --git a/packages/coding-agent/test/modes/components/tree-selector-shift-enter-8821.test.ts b/packages/coding-agent/test/modes/components/tree-selector-shift-enter-8821.test.ts index 70bd6a12a..c48e22a9d 100644 --- a/packages/coding-agent/test/modes/components/tree-selector-shift-enter-8821.test.ts +++ b/packages/coding-agent/test/modes/components/tree-selector-shift-enter-8821.test.ts @@ -80,10 +80,10 @@ describe("tree selector Shift+Enter fallback (issue #8821)", () => { expect(records).toEqual([{ entryId: responseEntry.id, options: { summarize: true } }]); }); - it("leaves the legacy CSI ~ form alone (parsed as shift+f3, not Enter)", () => { + it("treats the legacy CSI ~ form as Shift+Enter (summarize-and-switch), matching the composer", () => { const records: SelectRecord[] = []; const { selector } = selectorWithOnSelect([userEntry, responseEntry], records); selector.handleInput("\u001b[13;2~"); - expect(records).toEqual([]); + expect(records).toEqual([{ entryId: responseEntry.id, options: { summarize: true } }]); }); });