diff --git a/crates/agent_ui/src/agent_diff.rs b/crates/agent_ui/src/agent_diff.rs index c4dc359093..e1b3ef0910 100644 --- a/crates/agent_ui/src/agent_diff.rs +++ b/crates/agent_ui/src/agent_diff.rs @@ -30,7 +30,7 @@ use std::{ sync::Arc, time::Duration, }; -use ui::{IconButtonShape, KeyBinding, Tooltip, prelude::*, vertical_divider}; +use ui::{ButtonSize, IconButtonShape, KeyBinding, Tooltip, prelude::*, vertical_divider}; use util::ResultExt; use workspace::{ Item, ItemHandle, ItemNavHistory, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, @@ -796,17 +796,18 @@ fn render_diff_hunk_controls( .mr_0p5() .gap_1() .px_0p5() - .pb_1() + .py_0p5() .border_x_1() - .border_b_1() + .border_t_1() .border_color(cx.theme().colors().border) - .rounded_b_md() + .rounded_t_md() .bg(cx.theme().colors().editor_background) .gap_1() .block_mouse_except_scroll() .shadow_md() .children(vec![ Button::new(("reject", row as u64), "Reject") + .size(ButtonSize::Compact) .disabled(is_created_file) .key_binding( KeyBinding::for_action_in( @@ -835,6 +836,7 @@ fn render_diff_hunk_controls( } }), Button::new(("keep", row as u64), "Keep") + .size(ButtonSize::Compact) .key_binding( KeyBinding::for_action_in(&Keep, &editor.read(cx).focus_handle(cx), window, cx) .map(|kb| kb.size(rems_from_px(12.))), diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 3516eff45c..1e5e33529f 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -23656,17 +23656,18 @@ fn render_diff_hunk_controls( .mr_1() .gap_1() .px_0p5() - .pb_1() + .py_0p5() .border_x_1() - .border_b_1() + .border_t_1() .border_color(cx.theme().colors().border_variant) - .rounded_b_lg() + .rounded_t_lg() .bg(cx.theme().colors().editor_background) .gap_1() .block_mouse_except_scroll() .shadow_md() .child(if status.has_secondary_hunk() { Button::new(("stage", row as u64), "Stage") + .size(ButtonSize::Compact) .alpha(if status.is_pending() { 0.66 } else { 1.0 }) .tooltip({ let focus_handle = editor.focus_handle(cx); @@ -23694,6 +23695,7 @@ fn render_diff_hunk_controls( }) } else { Button::new(("unstage", row as u64), "Unstage") + .size(ButtonSize::Compact) .alpha(if status.is_pending() { 0.66 } else { 1.0 }) .tooltip({ let focus_handle = editor.focus_handle(cx); @@ -23722,6 +23724,7 @@ fn render_diff_hunk_controls( }) .child( Button::new(("restore", row as u64), "Restore") + .size(ButtonSize::Compact) .tooltip({ let focus_handle = editor.focus_handle(cx); move |window, cx| { diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 7e77f113ac..aab12f5ff2 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -4985,8 +4985,13 @@ impl EditorElement { .iter() .any(|p| p.map_or(false, |p| display_row_range.contains(&p.row()))) { - let y = display_row_range.start.as_f32() * line_height - + text_hitbox.bounds.top() + // Position controls at the end of the previous line to avoid covering diff content + let control_row = if display_row_range.start.0 > 0 { + display_row_range.start.0 - 1 + } else { + display_row_range.start.0 + }; + let y = control_row as f32 * line_height + text_hitbox.bounds.top() - scroll_pixel_position.y; let mut element = render_diff_hunk_controls(