mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 15:01:24 +00:00
fix(coding-agent): use visible leaf for tree display, preserve metadata on branch
This commit is contained in:
parent
5726770d1f
commit
e8debe78c6
1 changed files with 13 additions and 4 deletions
|
|
@ -1597,7 +1597,16 @@ export class InteractiveMode {
|
||||||
|
|
||||||
private showTreeSelector(): void {
|
private showTreeSelector(): void {
|
||||||
const tree = this.sessionManager.getTree();
|
const tree = this.sessionManager.getTree();
|
||||||
const currentLeafId = this.sessionManager.getLeafUuid();
|
const realLeafId = this.sessionManager.getLeafUuid();
|
||||||
|
|
||||||
|
// Find the visible leaf for display (skip metadata entries like labels)
|
||||||
|
let visibleLeafId = realLeafId;
|
||||||
|
while (visibleLeafId) {
|
||||||
|
const entry = this.sessionManager.getEntry(visibleLeafId);
|
||||||
|
if (!entry) break;
|
||||||
|
if (entry.type !== "label" && entry.type !== "custom") break;
|
||||||
|
visibleLeafId = entry.parentId ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
if (tree.length === 0) {
|
if (tree.length === 0) {
|
||||||
this.showStatus("No entries in session");
|
this.showStatus("No entries in session");
|
||||||
|
|
@ -1607,11 +1616,11 @@ export class InteractiveMode {
|
||||||
this.showSelector((done) => {
|
this.showSelector((done) => {
|
||||||
const selector = new TreeSelectorComponent(
|
const selector = new TreeSelectorComponent(
|
||||||
tree,
|
tree,
|
||||||
currentLeafId,
|
visibleLeafId,
|
||||||
this.ui.terminal.rows,
|
this.ui.terminal.rows,
|
||||||
async (entryId) => {
|
async (entryId) => {
|
||||||
// Check if selecting current leaf (no-op)
|
// Selecting the visible leaf is a no-op (already there)
|
||||||
if (entryId === currentLeafId) {
|
if (entryId === visibleLeafId) {
|
||||||
done();
|
done();
|
||||||
this.showStatus("Already at this point");
|
this.showStatus("Already at this point");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue