Nested Groups Fixes

This commit is contained in:
2025-11-29 19:05:54 +00:00
parent 757386f611
commit 9c7d9c5406
6 changed files with 73 additions and 39 deletions
+11 -2
View File
@@ -83,10 +83,19 @@
lastColorMapId = colorMapId;
});
// Get all interactive button indices
// Helper to check if a line or its children contain buttons
function hasButtons(line: TerminalLine): boolean {
if (line.type === 'button') return true;
if (line.type === 'group' && line.children) {
return line.children.some(child => hasButtons(child));
}
return false;
}
// Get all interactive button indices (including buttons nested in groups)
const buttonIndices = $derived(
displayedLines
.map((item, i) => item.parsed.line.type === 'button' ? i : -1)
.map((item, i) => hasButtons(item.parsed.line) ? i : -1)
.filter(i => i !== -1)
);