redbear-power: show live process filter input in keybar

Mirror the local process_filter_input buffer into App so render_keybar can display it. While filtering, the keybar shows "Filter: <buffer>  (N matches)  Enter:apply  Esc:clear  ↑↓:select" in a warm style instead of the normal hints. Build, 224 tests, clippy, and fmt clean.
This commit is contained in:
Sisyphus Agent
2026-07-07 15:33:15 +03:00
parent ab2798834c
commit 3452225e0e
3 changed files with 24 additions and 0 deletions
@@ -251,6 +251,7 @@ pub struct App {
pub toast_expires: Option<std::time::Instant>,
pub bench_line: String,
pub interval_input: Option<String>,
pub process_filter_input: Option<String>,
pub current_tab: TabId,
pub bench_start_time: Option<Instant>,
pub collector_stats: crate::collector::CollectorStats,
@@ -432,6 +433,7 @@ impl App {
toast_expires: None,
bench_line: String::new(),
interval_input: None,
process_filter_input: None,
current_tab: TabId::PerCpu,
bench_start_time: None,
meminfo: crate::meminfo::read_meminfo(),
@@ -420,7 +420,10 @@ fn main() -> io::Result<()> {
}
app.interval_input = interval_input.clone();
if let Some(buf) = process_filter_input.as_ref() {
app.process_filter_input = Some(buf.clone());
app.process_filter = buf.clone();
} else {
app.process_filter_input = None;
}
terminal.draw(|f| {
let full = f.area();
@@ -2122,6 +2122,25 @@ pub fn render_cpu_table<'a>(
pub fn render_keybar<'a>(app: &'a App) -> Paragraph<'a> {
let theme = &app.theme;
if let Some(ref buf) = app.process_filter_input {
let line = format!(
"Filter: {} ({} match{}) Enter:apply Esc:clear ↑↓:select",
if buf.is_empty() {
"<type to filter>"
} else {
buf.as_str()
},
app.visible_processes().len(),
if app.visible_processes().len() == 1 {
""
} else {
"es"
}
);
return Paragraph::new(line)
.style(theme.value_warm)
.block(Block::default().borders(Borders::NONE));
}
let gov = format!(" g:{}", app.cpufreq.active.as_str());
let interval = format!(" [/]:{}ms", app.poll_ms);
let tab_hints: &str = if app.current_tab == crate::app::TabId::Process {