Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Terminal header corners (#66367)

Chris Stoned94f32a1d948
diff --git a/crates/agent_ui/src/conversation_view/thread_view.rs b/crates/agent_ui/src/conversation_view/thread_view.rs
index 12f4e037c4b..f29e0fd6b9a 100644
--- a/crates/agent_ui/src/conversation_view/thread_view.rs
+++ b/crates/agent_ui/src/conversation_view/thread_view.rs
@@ -9159,7 +9159,6 @@ impl ThreadView {
// line (wrapped or not) is padded consistently.
style.code_block_overflow_x_scroll = false;
- let header_bg = self.tool_card_header_bg(cx);
let run_command_label = if is_preview {
Some(
h_flex().h_6().child(
@@ -9191,7 +9190,6 @@ impl ThreadView {
.group(group)
.relative()
.p_1p5()
- .bg(header_bg)
.when(is_preview, |this| this.pt_1().children(run_command_label))
.child(markdown_element)
.child(div().absolute().top_1().right_1().child(copy_button))
@@ -9294,12 +9292,22 @@ impl ThreadView {
}
});
+ let terminal_view = self
+ .entry_view_state
+ .read(cx)
+ .entry(entry_ix)
+ .and_then(|entry| entry.terminal(terminal));
+
+ let is_standalone = layout == ToolCallLayout::Standalone;
+ let has_content_below = (is_expanded && terminal_view.is_some()) || needs_confirmation;
+
let header = TerminalToolHeader::new(
terminal.entity_id().to_string(),
header_group,
working_dir,
is_expanded,
)
+ .rounded_corners(is_standalone, is_standalone && !has_content_below)
.elapsed(time_elapsed)
.running(!command_finished && !needs_confirmation)
.on_toggle_expand(cx.listener({
@@ -9337,12 +9345,6 @@ impl ThreadView {
})
.command_slot(command_element);
- let terminal_view = self
- .entry_view_state
- .read(cx)
- .entry(entry_ix)
- .and_then(|entry| entry.terminal(terminal));
-
v_flex()
.when(layout == ToolCallLayout::Standalone, |this| {
this.my_1p5()
@@ -9858,13 +9860,16 @@ impl ThreadView {
let body = v_flex()
.map(|this| {
if is_terminal_tool {
- this.child(self.render_collapsible_command(
- card_header_id.clone(),
- true,
- tool_call.label.clone(),
- window,
- cx,
- ))
+ this.child(
+ self.render_collapsible_command(
+ card_header_id.clone(),
+ true,
+ tool_call.label.clone(),
+ window,
+ cx,
+ )
+ .bg(self.tool_card_header_bg(cx)),
+ )
} else {
this.child(
h_flex()
diff --git a/crates/agent_ui/src/ui/terminal_tool_header.rs b/crates/agent_ui/src/ui/terminal_tool_header.rs
index bec794d2e86..ffe5c9897dd 100644
--- a/crates/agent_ui/src/ui/terminal_tool_header.rs
+++ b/crates/agent_ui/src/ui/terminal_tool_header.rs
@@ -29,6 +29,8 @@ pub struct TerminalToolHeader {
on_toggle_expand: Option<ClickHandler>,
on_stop: Option<ClickHandler>,
command_slot: Option<AnyElement>,
+ rounded_top: bool,
+ rounded_bottom: bool,
}
impl TerminalToolHeader {
@@ -52,9 +54,17 @@ impl TerminalToolHeader {
on_toggle_expand: None,
on_stop: None,
command_slot: None,
+ rounded_top: false,
+ rounded_bottom: false,
}
}
+ pub fn rounded_corners(mut self, top: bool, bottom: bool) -> Self {
+ self.rounded_top = top;
+ self.rounded_bottom = bottom;
+ self
+ }
+
pub fn elapsed(mut self, elapsed: Duration) -> Self {
self.elapsed = Some(elapsed);
self
@@ -123,6 +133,8 @@ impl RenderOnce for TerminalToolHeader {
on_toggle_expand,
on_stop,
command_slot,
+ rounded_top,
+ rounded_bottom,
} = self;
let child_id = |name: &str| format!("terminal-tool-{name}-{id}");
@@ -247,6 +259,8 @@ impl RenderOnce for TerminalToolHeader {
.group(hover_group)
.text_xs()
.bg(header_bg)
+ .when(rounded_top, |header| header.rounded_t_md())
+ .when(rounded_bottom, |header| header.rounded_b_md())
.child(header_row)
.children(command_slot)
}