Skip to content

Commit 83b670b

Browse files
committed
@ context menu fixes.
1 parent 0ca787c commit 83b670b

4 files changed

Lines changed: 22 additions & 4 deletions

File tree

app/src/search/ai_context_menu/styles.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ pub const ICON_SIZE: f32 = 16.0;
22
pub const MARGIN_RIGHT: f32 = 8.0;
33
pub const ESTIMATED_RESULT_HEIGHT: f32 = 24.0;
44
pub const MENU_ITEM_HORIZONTAL_PADDING: f32 = 16.0;
5-
pub const MENU_ITEM_VERTICAL_PADDING: f32 = 4.0;
5+
pub const MENU_ITEM_HIGHLIGHT_CORNER_RADIUS: f32 = 8.0;

app/src/search/ai_context_menu/view.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,8 +1287,11 @@ impl AIContextMenu {
12871287
return self.render_no_results(app);
12881288
}
12891289

1290+
let last_display_index = filtered_categories.len().saturating_sub(1);
12901291
for (display_index, category) in filtered_categories.iter().enumerate() {
12911292
let is_selected = display_index == self.state.selected_category_index;
1293+
let is_first = display_index == 0;
1294+
let is_last = display_index == last_display_index;
12921295
let text_color = if is_selected {
12931296
theme.main_text_color(theme.accent()).into_solid()
12941297
} else {
@@ -1347,11 +1350,20 @@ impl AIContextMenu {
13471350
let accent_color = theme.accent();
13481351
let accent_overlay_color = theme.accent_overlay();
13491352

1353+
let highlight_radius = Radius::Pixels(styles::MENU_ITEM_HIGHLIGHT_CORNER_RADIUS);
1354+
let highlight_corner_radius = match (is_first, is_last) {
1355+
(true, true) => CornerRadius::with_all(highlight_radius),
1356+
(true, false) => CornerRadius::with_top(highlight_radius),
1357+
(false, true) => CornerRadius::with_bottom(highlight_radius),
1358+
(false, false) => CornerRadius::default(),
1359+
};
1360+
13501361
let category_clone_for_click = *category;
13511362
let category_row = Hoverable::new(hover_state, move |hover_state| {
13521363
let mut container = Container::new(row)
13531364
.with_horizontal_padding(styles::MENU_ITEM_HORIZONTAL_PADDING)
1354-
.with_vertical_padding(styles::MENU_ITEM_VERTICAL_PADDING);
1365+
.with_vertical_padding(styles::MENU_ITEM_VERTICAL_PADDING)
1366+
.with_corner_radius(highlight_corner_radius);
13551367
if is_selected {
13561368
container = container.with_background(accent_color);
13571369
} else if hover_state.is_hovered() {

app/src/terminal/input.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3429,6 +3429,12 @@ impl Input {
34293429
if let Some(ai_context_menu) = self.editor.as_ref(app).render_ai_context_menu() {
34303430
let position = position_id_for_cursor(self.editor.id());
34313431

3432+
let y_anchor = if self.is_cloud_mode_input_v2_composing(app) {
3433+
AnchorPair::new(YAxisAnchor::Bottom, YAxisAnchor::Top)
3434+
} else {
3435+
menu_positioning.completion_suggestions_y_anchor()
3436+
};
3437+
34323438
stack.add_positioned_overlay_child(
34333439
ai_context_menu,
34343440
OffsetPositioning::from_axes(
@@ -3442,7 +3448,7 @@ impl Input {
34423448
&position,
34433449
PositionedElementOffsetBounds::Unbounded,
34443450
OffsetType::Pixel(0.),
3445-
menu_positioning.completion_suggestions_y_anchor(),
3451+
y_anchor,
34463452
),
34473453
),
34483454
);

app/src/terminal/input/agent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ impl Input {
333333
let menu_positioning = self.menu_positioning(app);
334334
let model = self.model.lock();
335335

336-
let mut stack = Stack::new().with_constrain_absolute_children();
336+
let mut stack = Stack::new();
337337

338338
// Apply the V2 gutter symmetrically (left + right) so the floating
339339
// input keeps equal breathing room on both sides as the pane shrinks.

0 commit comments

Comments
 (0)