Show every agent tab's summary, not just the focused one
The tab bar's row-2 summary was painted only for the active tab. Add a per-child summaryTextFor/summaryRawFor helper (active variants now delegate to it), carry each tab's childID on its tabRect, and loop over all visible tabs so each renders its own summary under its column. Layout is unchanged (still 3 rows); narrow tabs clip as before. Resolves the per-tab summary TODO item.
This commit is contained in:
@@ -59,6 +59,7 @@ func (st *uiState) drawTabBar() {
|
||||
newHintW := utf8.RuneCountInString(newHint) + 2 // " + new " framing
|
||||
|
||||
type tabRect struct {
|
||||
childID string
|
||||
startCol int
|
||||
width int
|
||||
label string
|
||||
@@ -66,8 +67,6 @@ func (st *uiState) drawTabBar() {
|
||||
glyphStyle string
|
||||
active bool
|
||||
}
|
||||
activeTab := -1
|
||||
|
||||
// Reserve space at the right edge for "+ new". If there are too
|
||||
// many tabs to fit even at minTabWidth, drop tabs from the right
|
||||
// until they do. The current focus stays visible.
|
||||
@@ -139,6 +138,7 @@ func (st *uiState) drawTabBar() {
|
||||
labelW = utf8.RuneCountInString(label)
|
||||
}
|
||||
tabs = append(tabs, tabRect{
|
||||
childID: c.ID,
|
||||
startCol: col,
|
||||
width: w,
|
||||
label: label,
|
||||
@@ -146,9 +146,6 @@ func (st *uiState) drawTabBar() {
|
||||
glyphStyle: glyphStyle,
|
||||
active: active,
|
||||
})
|
||||
if tabs[len(tabs)-1].active {
|
||||
activeTab = len(tabs) - 1
|
||||
}
|
||||
col += w
|
||||
}
|
||||
}
|
||||
@@ -224,10 +221,9 @@ func (st *uiState) drawTabBar() {
|
||||
hintCol, styleBorder, strings.Repeat("─", newHintW), styleReset)
|
||||
}
|
||||
|
||||
if activeTab >= 0 {
|
||||
tab := tabs[activeTab]
|
||||
for _, tab := range tabs {
|
||||
summaryWidth := tab.width - 2
|
||||
if summary := st.activeSummaryText(summaryWidth); summary != "" {
|
||||
if summary := st.summaryTextFor(tab.childID, summaryWidth); summary != "" {
|
||||
fmt.Fprintf(&b, "\x1b[2;%dH %s%s%s", tab.startCol, styleDim, summary, styleReset)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user