Add status column to context tree with tab-stop alignment

SectionView gains a status field for extra info displayed after the
token count column. Memory nodes section shows "N scored, M unscored"
in the status column instead of burying it in the title.

Renderer uses fixed-width columns (40 name, 16 tokens, status) for
consistent alignment across sections.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 22:13:27 -04:00
parent 07b400c95c
commit c7c69a8f06
3 changed files with 15 additions and 2 deletions

View file

@ -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),
});
}