fix(tui): also accept legacy CSI ~ Shift+Enter form in /tree selector

Mirrors the composer's raw-sequence fallback (editor.ts:1466) so
\x1b[13;2~ triggers summarize-and-switch instead of being dropped as
shift+f3, completing the parity requested in issue #8821.
This commit is contained in:
can1357
2026-08-19 01:04:12 +02:00
parent f60e32f9b8
commit 130cc9c0a3
2 changed files with 4 additions and 3 deletions
@@ -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];
@@ -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 } }]);
});
});