diff --git a/src/user/context.rs b/src/user/context.rs index 2ae623e..a3668e5 100644 --- a/src/user/context.rs +++ b/src/user/context.rs @@ -53,16 +53,18 @@ impl ConsciousScreen { tokens: ce.tokens, content: ce.entry.message().content_text().to_string(), children: Vec::new(), + status: String::new(), }); } } if !mem_children.is_empty() { let mem_tokens: usize = mem_children.iter().map(|c| c.tokens).sum(); views.push(SectionView { - name: format!("Memory nodes ({} scored, {} unscored)", scored, unscored), + name: format!("Memory nodes ({})", mem_children.len()), tokens: mem_tokens, content: String::new(), children: mem_children, + status: format!("{} scored, {} unscored", scored, unscored), }); } diff --git a/src/user/subconscious.rs b/src/user/subconscious.rs index e2662c2..661c82f 100644 --- a/src/user/subconscious.rs +++ b/src/user/subconscious.rs @@ -139,6 +139,7 @@ impl SubconsciousScreen { tokens: 0, content: val.clone(), children: Vec::new(), + status: String::new(), } }).collect() } diff --git a/src/user/widgets.rs b/src/user/widgets.rs index 00734f0..0050924 100644 --- a/src/user/widgets.rs +++ b/src/user/widgets.rs @@ -18,6 +18,8 @@ pub struct SectionView { pub tokens: usize, pub content: String, pub children: Vec, + /// Extra status text shown after the token count. + pub status: String, } /// Build a SectionView tree from a ContextSection. @@ -34,6 +36,7 @@ pub fn section_to_view(section: &ContextSection) -> SectionView { tokens: ce.tokens, content, children: Vec::new(), + status: String::new(), } }).collect(); SectionView { @@ -41,6 +44,7 @@ pub fn section_to_view(section: &ContextSection) -> SectionView { tokens: section.tokens(), content: String::new(), children, + status: String::new(), } } @@ -244,7 +248,13 @@ impl SectionTree { let indent = " ".repeat(depth + 1); let marker = if !expandable { " " } else if expanded { "▼" } else { "▶" }; - let label = format!("{}{} {:30} {:>6} tokens", indent, marker, section.name, section.tokens); + let name_col = format!("{}{} {}", indent, marker, section.name); + let tokens_col = format!("{:>6} tokens", section.tokens); + let label = if section.status.is_empty() { + format!("{:40} {}", name_col, tokens_col) + } else { + format!("{:40} {:16} {}", name_col, tokens_col, section.status) + }; let style = if selected { Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD) } else {