acp: Fix accidentally reverted thread view changes (#36825)
Merge conflict resolution for #36741 accidentally reverted the changes in #36670 to allow expanding terminals individually and in #36675 to allow collapsing edit cards. This PR re-applies those changes, fixing the regression. Release Notes: - N/A
This commit is contained in:
parent
19764794b7
commit
1b91f3de41
1 changed files with 16 additions and 11 deletions
|
@ -274,7 +274,6 @@ pub struct AcpThreadView {
|
||||||
edits_expanded: bool,
|
edits_expanded: bool,
|
||||||
plan_expanded: bool,
|
plan_expanded: bool,
|
||||||
editor_expanded: bool,
|
editor_expanded: bool,
|
||||||
terminal_expanded: bool,
|
|
||||||
editing_message: Option<usize>,
|
editing_message: Option<usize>,
|
||||||
prompt_capabilities: Rc<Cell<PromptCapabilities>>,
|
prompt_capabilities: Rc<Cell<PromptCapabilities>>,
|
||||||
is_loading_contents: bool,
|
is_loading_contents: bool,
|
||||||
|
@ -386,7 +385,6 @@ impl AcpThreadView {
|
||||||
edits_expanded: false,
|
edits_expanded: false,
|
||||||
plan_expanded: false,
|
plan_expanded: false,
|
||||||
editor_expanded: false,
|
editor_expanded: false,
|
||||||
terminal_expanded: true,
|
|
||||||
history_store,
|
history_store,
|
||||||
hovered_recent_history_item: None,
|
hovered_recent_history_item: None,
|
||||||
prompt_capabilities,
|
prompt_capabilities,
|
||||||
|
@ -1722,10 +1720,9 @@ impl AcpThreadView {
|
||||||
matches!(tool_call.kind, acp::ToolKind::Edit) || tool_call.diffs().next().is_some();
|
matches!(tool_call.kind, acp::ToolKind::Edit) || tool_call.diffs().next().is_some();
|
||||||
let use_card_layout = needs_confirmation || is_edit;
|
let use_card_layout = needs_confirmation || is_edit;
|
||||||
|
|
||||||
let is_collapsible = !tool_call.content.is_empty() && !use_card_layout;
|
let is_collapsible = !tool_call.content.is_empty() && !needs_confirmation;
|
||||||
|
|
||||||
let is_open =
|
let is_open = needs_confirmation || self.expanded_tool_calls.contains(&tool_call.id);
|
||||||
needs_confirmation || is_edit || self.expanded_tool_calls.contains(&tool_call.id);
|
|
||||||
|
|
||||||
let gradient_overlay = |color: Hsla| {
|
let gradient_overlay = |color: Hsla| {
|
||||||
div()
|
div()
|
||||||
|
@ -2195,6 +2192,8 @@ impl AcpThreadView {
|
||||||
.map(|path| format!("{}", path.display()))
|
.map(|path| format!("{}", path.display()))
|
||||||
.unwrap_or_else(|| "current directory".to_string());
|
.unwrap_or_else(|| "current directory".to_string());
|
||||||
|
|
||||||
|
let is_expanded = self.expanded_tool_calls.contains(&tool_call.id);
|
||||||
|
|
||||||
let header = h_flex()
|
let header = h_flex()
|
||||||
.id(SharedString::from(format!(
|
.id(SharedString::from(format!(
|
||||||
"terminal-tool-header-{}",
|
"terminal-tool-header-{}",
|
||||||
|
@ -2328,21 +2327,27 @@ impl AcpThreadView {
|
||||||
"terminal-tool-disclosure-{}",
|
"terminal-tool-disclosure-{}",
|
||||||
terminal.entity_id()
|
terminal.entity_id()
|
||||||
)),
|
)),
|
||||||
self.terminal_expanded,
|
is_expanded,
|
||||||
)
|
)
|
||||||
.opened_icon(IconName::ChevronUp)
|
.opened_icon(IconName::ChevronUp)
|
||||||
.closed_icon(IconName::ChevronDown)
|
.closed_icon(IconName::ChevronDown)
|
||||||
.on_click(cx.listener(move |this, _event, _window, _cx| {
|
.on_click(cx.listener({
|
||||||
this.terminal_expanded = !this.terminal_expanded;
|
let id = tool_call.id.clone();
|
||||||
})),
|
move |this, _event, _window, _cx| {
|
||||||
);
|
if is_expanded {
|
||||||
|
this.expanded_tool_calls.remove(&id);
|
||||||
|
} else {
|
||||||
|
this.expanded_tool_calls.insert(id.clone());
|
||||||
|
}
|
||||||
|
}})),
|
||||||
|
);
|
||||||
|
|
||||||
let terminal_view = self
|
let terminal_view = self
|
||||||
.entry_view_state
|
.entry_view_state
|
||||||
.read(cx)
|
.read(cx)
|
||||||
.entry(entry_ix)
|
.entry(entry_ix)
|
||||||
.and_then(|entry| entry.terminal(terminal));
|
.and_then(|entry| entry.terminal(terminal));
|
||||||
let show_output = self.terminal_expanded && terminal_view.is_some();
|
let show_output = is_expanded && terminal_view.is_some();
|
||||||
|
|
||||||
v_flex()
|
v_flex()
|
||||||
.mb_2()
|
.mb_2()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue