aboutsummaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/mobile.rs11
-rw-r--r--src/ui/navigator.rs26
-rw-r--r--src/ui/panes.rs2
-rw-r--r--src/ui/sidebar.rs20
4 files changed, 48 insertions, 11 deletions
diff --git a/src/ui/mobile.rs b/src/ui/mobile.rs
index 89557642..2de79d23 100644
--- a/src/ui/mobile.rs
+++ b/src/ui/mobile.rs
@@ -622,7 +622,15 @@ fn mobile_agent_detail(entry: &AgentPanelEntry) -> String {
if let Some(tab_label) = entry.primary_tab_label.as_deref() {
parts.push(tab_label.to_string());
}
- parts.push(super::status::state_label(entry.state, entry.seen).to_string());
+ let status = entry
+ .state_labels
+ .get(super::sidebar::agent_panel_status_key(
+ entry.state,
+ entry.seen,
+ ))
+ .cloned()
+ .unwrap_or_else(|| super::status::state_label(entry.state, entry.seen).to_string());
+ parts.push(status);
if let Some(agent_label) = entry.agent_label.as_deref() {
parts.push(agent_label.to_string());
}
@@ -940,6 +948,7 @@ mod tests {
state: AgentState::Idle,
seen: true,
custom_status: None,
+ state_labels: std::collections::HashMap::new(),
}
}
diff --git a/src/ui/navigator.rs b/src/ui/navigator.rs
index 5cb208ae..b6bc1f19 100644
--- a/src/ui/navigator.rs
+++ b/src/ui/navigator.rs
@@ -362,20 +362,30 @@ fn pane_detail(
}
if let Some(terminal_id) = tab.terminal_id(pane_id) {
if let Some(terminal) = app.terminals.get(terminal_id) {
- if let Some(agent) = terminal
- .agent_name
- .as_deref()
- .or_else(|| terminal.effective_agent_label())
- {
+ let presentation = terminal.effective_presentation();
+ if let Some(title) = presentation.title {
+ parts.push(title);
+ }
+ let display_agent = terminal.effective_display_agent();
+ if let Some(agent) = display_agent.as_deref().or_else(|| {
+ terminal
+ .agent_name
+ .as_deref()
+ .or_else(|| terminal.effective_agent_label())
+ }) {
parts.push(agent.to_string());
let seen = tab
.panes
.get(&pane_id)
.map(|pane| pane.seen)
.unwrap_or(true);
- parts.push(
- display_state(row_state(app, ws_idx, tab_idx, pane_id), seen).to_string(),
- );
+ let state = row_state(app, ws_idx, tab_idx, pane_id);
+ let status = presentation
+ .state_labels
+ .get(display_state(state, seen))
+ .cloned()
+ .unwrap_or_else(|| display_state(state, seen).to_string());
+ parts.push(status);
} else {
parts.push("shell".to_string());
}
diff --git a/src/ui/panes.rs b/src/ui/panes.rs
index a1729cd6..c211ec9d 100644
--- a/src/ui/panes.rs
+++ b/src/ui/panes.rs
@@ -282,7 +282,7 @@ pub(super) fn render_panes(
.and_then(|terminal| {
terminal.border_label(app.show_agent_labels_on_pane_borders)
})
- .and_then(|label| pane_border_title(label, info.rect.width))
+ .and_then(|label| pane_border_title(&label, info.rect.width))
{
block = block.title(Line::from(Span::styled(title, border_style)));
}
diff --git a/src/ui/sidebar.rs b/src/ui/sidebar.rs
index 1e932503..4c68aeb4 100644
--- a/src/ui/sidebar.rs
+++ b/src/ui/sidebar.rs
@@ -26,6 +26,7 @@ pub(crate) struct AgentPanelEntry {
pub state: AgentState,
pub seen: bool,
pub custom_status: Option<String>,
+ pub state_labels: std::collections::HashMap<String, String>,
}
fn sidebar_section_heights(total_h: u16, split_ratio: f32) -> (u16, u16) {
@@ -153,6 +154,7 @@ fn agent_panel_entries_with_runtimes(
state: detail.state,
seen: detail.seen,
custom_status: detail.custom_status,
+ state_labels: detail.state_labels,
})
.collect()
}
@@ -175,12 +177,23 @@ fn agent_panel_entries_with_runtimes(
state: detail.state,
seen: detail.seen,
custom_status: detail.custom_status,
+ state_labels: detail.state_labels,
})
})
.collect(),
}
}
+pub(super) fn agent_panel_status_key(state: AgentState, seen: bool) -> &'static str {
+ match (state, seen) {
+ (AgentState::Idle, false) => "done",
+ (AgentState::Idle, true) => "idle",
+ (AgentState::Working, _) => "working",
+ (AgentState::Blocked, _) => "blocked",
+ (AgentState::Unknown, _) => "unknown",
+ }
+}
+
fn truncate_text(text: &str, max_width: usize) -> String {
let len = text.chars().count();
if len <= max_width {
@@ -1090,7 +1103,11 @@ fn render_agent_detail(
let (icon, icon_style) = agent_icon(detail.state, detail.seen, app.spinner_tick, p);
let label_color = state_label_color(detail.state, detail.seen, p);
- let label = state_label(detail.state, detail.seen);
+ let label = detail
+ .state_labels
+ .get(agent_panel_status_key(detail.state, detail.seen))
+ .map(String::as_str)
+ .unwrap_or_else(|| state_label(detail.state, detail.seen));
let row_style = if is_active {
Style::default().bg(p.surface_dim)
@@ -1334,6 +1351,7 @@ mod tests {
state: AgentState::Idle,
seen: true,
custom_status: None,
+ state_labels: std::collections::HashMap::new(),
};
let label = format_agent_panel_primary_label(&entry, 18);