Add a hide shortcut to the agents overview (#44424)

## What changed

- Add `Ctrl+W` to hide the selected task without stopping it. Hidden tasks stay hidden through activity and metadata refreshes until explicitly resumed or the TUI restarts.
- Expose `agents.hide` in keymap configuration and the shortcut picker, and let the default binding yield to existing custom shortcuts.
- Wrap overview footer hints while keeping shortcuts and their labels together when they fit.

## Testing

Add coverage for hiding filtered tasks across statuses, visibility through activity and refreshes, explicit resume, existing keybinding compatibility, and custom chord footer rendering at narrow widths.

GitOrigin-RevId: 980726e1095b8d5bad8901be919decdde8c0f925
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-10 05:41:54 +00:00
1 parent ddea03ad04
commit bf5ebd98c5
24 files changed
+339 -24

No files matched your search

+37 -12
View File
@@ -25,6 +25,7 @@ impl AgentsOverviewView {
&self.agents_keymap.new_task,
&self.agents_keymap.rename,
&self.agents_keymap.stop,
&self.agents_keymap.hide,
&self.agents_keymap.toggle_grouping,
]
.into_iter()
@@ -46,15 +47,20 @@ impl AgentsOverviewView {
" "
},
);
let mut footer_spans = Vec::new();
let mut hints: Vec<Line<'static>> = Vec::new();
if !navigation_hint.is_empty() {
footer_spans.extend([navigation_hint.bold(), " navigate ".dim()]);
hints.push(vec![navigation_hint.bold(), " navigate".dim()].into());
}
let mut add_hint = |hint: Option<ShortcutHint>, label: &'static str, enabled: bool| {
if let Some(hint) = hint {
let key = hint.display_label().replace(" + ", "+");
footer_spans.push(if enabled { key.bold() } else { key.dim() });
footer_spans.push(format!(" {label} ").dim());
hints.push(
vec![
if enabled { key.bold() } else { key.dim() },
format!(" {label}").dim(),
]
.into(),
);
}
};
add_hint(
@@ -99,16 +105,35 @@ impl AgentsOverviewView {
self.selected_row()
.is_some_and(|row| matches!(row.thread.status, ThreadStatus::Active { .. })),
);
add_hint(
self.agents_keymap
.primary_hint("hide", &self.agents_keymap.hide),
"hide",
self.selected_row().is_some(),
);
add_hint(list_hint(ListAction::Cancel), "back", true);
let mut footer_line: Line = footer_spans.into();
if footer_line.width() > usize::from(width) {
for span in &mut footer_line.spans {
if span.content.ends_with(" ") {
span.content.to_mut().pop();
let separator = if hints.iter().map(Line::width).sum::<usize>()
+ hints.len().saturating_sub(1) * 2
<= usize::from(width)
{
" "
} else {
" "
};
crate::footer_hint::wrap_hint_rows(hints, width, separator.len(), Line::width)
.into_iter()
.flat_map(|row| {
let mut line = Line::default();
for hint in row {
if !line.spans.is_empty() {
line.spans.push(separator.dim());
}
line.spans.extend(hint.spans);
}
}
}
crate::wrapping::word_wrap_lines([footer_line], usize::from(width))
// An individual custom chord may be wider than the entire terminal.
crate::wrapping::word_wrap_lines([line], usize::from(width.max(1)))
})
.collect()
}
}