mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 21:02:02 +00:00
fix(coding-agent): display multiple roots at indent 0, keep child logic intact
This commit is contained in:
parent
32ec1fa883
commit
e50eae1054
1 changed files with 5 additions and 1 deletions
|
|
@ -46,6 +46,7 @@ class TreeList implements Component {
|
||||||
private filterMode: FilterMode = "default";
|
private filterMode: FilterMode = "default";
|
||||||
private searchQuery = "";
|
private searchQuery = "";
|
||||||
private toolCallMap: Map<string, ToolCallInfo> = new Map();
|
private toolCallMap: Map<string, ToolCallInfo> = new Map();
|
||||||
|
private multipleRoots = false;
|
||||||
|
|
||||||
public onSelect?: (entryId: string) => void;
|
public onSelect?: (entryId: string) => void;
|
||||||
public onCancel?: () => void;
|
public onCancel?: () => void;
|
||||||
|
|
@ -54,6 +55,7 @@ class TreeList implements Component {
|
||||||
constructor(tree: SessionTreeNode[], currentLeafId: string | null, maxVisibleLines: number) {
|
constructor(tree: SessionTreeNode[], currentLeafId: string | null, maxVisibleLines: number) {
|
||||||
this.currentLeafId = currentLeafId;
|
this.currentLeafId = currentLeafId;
|
||||||
this.maxVisibleLines = maxVisibleLines;
|
this.maxVisibleLines = maxVisibleLines;
|
||||||
|
this.multipleRoots = tree.length > 1;
|
||||||
this.flatNodes = this.flattenTree(tree);
|
this.flatNodes = this.flattenTree(tree);
|
||||||
this.applyFilter();
|
this.applyFilter();
|
||||||
|
|
||||||
|
|
@ -305,7 +307,9 @@ class TreeList implements Component {
|
||||||
|
|
||||||
// Build line: cursor + indent + label + content + suffix
|
// Build line: cursor + indent + label + content + suffix
|
||||||
const cursor = isSelected ? theme.fg("accent", "› ") : " ";
|
const cursor = isSelected ? theme.fg("accent", "› ") : " ";
|
||||||
const indentStr = " ".repeat(flatNode.indent);
|
// If multiple roots, shift indent down by 1 for display (roots at 0, not 1)
|
||||||
|
const displayIndent = this.multipleRoots ? Math.max(0, flatNode.indent - 1) : flatNode.indent;
|
||||||
|
const indentStr = " ".repeat(displayIndent);
|
||||||
const label = flatNode.node.label ? theme.fg("warning", `[${flatNode.node.label}] `) : "";
|
const label = flatNode.node.label ? theme.fg("warning", `[${flatNode.node.label}] `) : "";
|
||||||
const content = this.getEntryDisplayText(flatNode.node, isSelected);
|
const content = this.getEntryDisplayText(flatNode.node, isSelected);
|
||||||
const suffix = isCurrentLeaf ? theme.fg("accent", " *") : "";
|
const suffix = isCurrentLeaf ? theme.fg("accent", " *") : "";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue