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.

agent: Do not render unnecessary lines in edit file tool card (#29766)

Finn Evers92b9ecd7d297
diff --git a/crates/assistant_tools/src/edit_file_tool.rs b/crates/assistant_tools/src/edit_file_tool.rs
index 0c995a58fc0..be276fcc816 100644
--- a/crates/assistant_tools/src/edit_file_tool.rs
+++ b/crates/assistant_tools/src/edit_file_tool.rs
@@ -577,13 +577,10 @@ impl ToolCard for EditFileToolCard {
card.child(
v_flex()
.relative()
- .map(|editor_container| {
- if self.full_height_expanded {
- editor_container.h_full()
- } else {
- editor_container
- .h(DEFAULT_COLLAPSED_LINES as f32 * editor_line_height)
- }
+ .h_full()
+ .when(!self.full_height_expanded, |editor_container| {
+ editor_container
+ .max_h(DEFAULT_COLLAPSED_LINES as f32 * editor_line_height)
})
.overflow_hidden()
.border_t_1()
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 56bb7740fa8..7c8848d841e 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -6874,7 +6874,12 @@ impl Element for EditorElement {
// The max scroll position for the top of the window
let max_scroll_top = if matches!(
snapshot.mode,
- EditorMode::AutoHeight { .. } | EditorMode::SingleLine { .. }
+ EditorMode::SingleLine { .. }
+ | EditorMode::AutoHeight { .. }
+ | EditorMode::Full {
+ sized_by_content: true,
+ ..
+ }
) {
(max_row - height_in_lines + 1.).max(0.)
} else {