Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions crates/agent_ui/src/acp/thread_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ pub struct AcpThreadView {
thread_feedback: ThreadFeedbackState,
list_state: ListState,
auth_task: Option<Task<()>>,
collapsed_tool_calls: HashSet<acp::ToolCallId>,
expanded_tool_calls: HashSet<acp::ToolCallId>,
expanded_thinking_blocks: HashSet<(usize, usize)>,
edits_expanded: bool,
plan_expanded: bool,
Expand Down Expand Up @@ -428,7 +428,7 @@ impl AcpThreadView {
thread_error: None,
thread_feedback: Default::default(),
auth_task: None,
collapsed_tool_calls: HashSet::default(),
expanded_tool_calls: HashSet::default(),
expanded_thinking_blocks: HashSet::default(),
editing_message: None,
edits_expanded: false,
Expand Down Expand Up @@ -965,17 +965,17 @@ impl AcpThreadView {
) {
match &event.view_event {
ViewEvent::NewDiff(tool_call_id) => {
if !AgentSettings::get_global(cx).expand_edit_card {
self.collapsed_tool_calls.insert(tool_call_id.clone());
if AgentSettings::get_global(cx).expand_edit_card {
self.expanded_tool_calls.insert(tool_call_id.clone());
}
}
ViewEvent::NewTerminal(tool_call_id) => {
if !AgentSettings::get_global(cx).expand_terminal_card {
self.collapsed_tool_calls.insert(tool_call_id.clone());
if AgentSettings::get_global(cx).expand_terminal_card {
self.expanded_tool_calls.insert(tool_call_id.clone());
}
}
ViewEvent::TerminalMovedToBackground(tool_call_id) => {
self.collapsed_tool_calls.insert(tool_call_id.clone());
self.expanded_tool_calls.remove(tool_call_id);
}
ViewEvent::MessageEditorEvent(_editor, MessageEditorEvent::Focus) => {
if let Some(thread) = self.thread()
Expand Down Expand Up @@ -2130,7 +2130,7 @@ impl AcpThreadView {

let is_collapsible = !tool_call.content.is_empty() && !needs_confirmation;

let is_open = needs_confirmation || !self.collapsed_tool_calls.contains(&tool_call.id);
let is_open = needs_confirmation || self.expanded_tool_calls.contains(&tool_call.id);

let tool_output_display =
if is_open {
Expand Down Expand Up @@ -2280,9 +2280,9 @@ impl AcpThreadView {
let id = tool_call.id.clone();
move |this: &mut Self, _, _, cx: &mut Context<Self>| {
if is_open {
this.collapsed_tool_calls.insert(id.clone());
this.expanded_tool_calls.remove(&id);
} else {
this.collapsed_tool_calls.remove(&id);
this.expanded_tool_calls.insert(id.clone());
}
cx.notify();
}
Expand Down Expand Up @@ -2484,7 +2484,7 @@ impl AcpThreadView {
.icon_color(Color::Muted)
.on_click(cx.listener({
move |this: &mut Self, _, _, cx: &mut Context<Self>| {
this.collapsed_tool_calls.insert(tool_call_id.clone());
this.expanded_tool_calls.remove(&tool_call_id);
cx.notify();
}
})),
Expand Down Expand Up @@ -2762,7 +2762,7 @@ impl AcpThreadView {
.map(|path| path.display().to_string())
.unwrap_or_else(|| "current directory".to_string());

let is_expanded = !self.collapsed_tool_calls.contains(&tool_call.id);
let is_expanded = self.expanded_tool_calls.contains(&tool_call.id);

let header = h_flex()
.id(header_id)
Expand Down Expand Up @@ -2897,9 +2897,9 @@ impl AcpThreadView {
let id = tool_call.id.clone();
move |this, _event, _window, _cx| {
if is_expanded {
this.collapsed_tool_calls.insert(id.clone());
this.expanded_tool_calls.remove(&id);
} else {
this.collapsed_tool_calls.remove(&id);
this.expanded_tool_calls.insert(id.clone());
}
}
})),
Expand Down
Loading