Merge PR #8916: fix(tui): treat bare LF as Shift+Enter in the /tree selector (@re2zero)

This commit is contained in:
can1357
2026-08-19 01:38:35 +02:00
2 changed files with 95 additions and 2 deletions
@@ -849,13 +849,17 @@ class TreeList implements Component {
this.#selectedIndex = Math.max(0, this.#selectedIndex - this.maxVisibleLines);
} else if (matchesSelectPageDown(keyData) || matchesKey(keyData, "right")) {
this.#selectedIndex = Math.min(this.#filteredNodes.length - 1, this.#selectedIndex + this.maxVisibleLines);
} else if (matchesKey(keyData, "shift+enter") || matchesKey(keyData, "shift+return")) {
} 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)
) {
// Summarize-and-switch: fork with a branch summary without the extra prompt.
const selected = this.#filteredNodes[this.#selectedIndex];
if (selected && this.onSelect) {
this.onSelect(selected.node.entry.id, { summarize: true });
}
} else if (matchesKey(keyData, "enter") || matchesKey(keyData, "return") || keyData === "\n") {
} else if (matchesKey(keyData, "enter") || matchesKey(keyData, "return")) {
const selected = this.#filteredNodes[this.#selectedIndex];
if (selected && this.onSelect) {
this.onSelect(selected.node.entry.id, { summarize: false });