diff --git a/crates/zed/src/zed/linux_prompts.rs b/crates/zed/src/zed/linux_prompts.rs index 7493f8c6f3..1961a5f9cd 100644 --- a/crates/zed/src/zed/linux_prompts.rs +++ b/crates/zed/src/zed/linux_prompts.rs @@ -31,7 +31,7 @@ pub fn fallback_prompt_renderer( detail: detail.map(ToString::to_string), actions: actions.iter().map(ToString::to_string).collect(), focus: cx.focus_handle(), - active_action_id: actions.len() - 1, + active_action_id: 0, } }); @@ -60,21 +60,16 @@ impl FallbackPromptRenderer { } fn select_first(&mut self, _: &menu::SelectFirst, cx: &mut ViewContext) { - self.active_action_id = 0; - cx.notify(); - } - - fn select_last(&mut self, _: &menu::SelectLast, cx: &mut ViewContext) { self.active_action_id = self.actions.len().saturating_sub(1); cx.notify(); } - fn select_next(&mut self, _: &menu::SelectNext, cx: &mut ViewContext) { - self.active_action_id = (self.active_action_id + 1) % self.actions.len(); + fn select_last(&mut self, _: &menu::SelectLast, cx: &mut ViewContext) { + self.active_action_id = 0; cx.notify(); } - fn select_prev(&mut self, _: &menu::SelectPrev, cx: &mut ViewContext) { + fn select_next(&mut self, _: &menu::SelectNext, cx: &mut ViewContext) { if self.active_action_id > 0 { self.active_action_id -= 1; } else { @@ -82,6 +77,11 @@ impl FallbackPromptRenderer { } cx.notify(); } + + fn select_prev(&mut self, _: &menu::SelectPrev, cx: &mut ViewContext) { + self.active_action_id = (self.active_action_id + 1) % self.actions.len(); + cx.notify(); + } } impl Render for FallbackPromptRenderer { @@ -119,7 +119,7 @@ impl Render for FallbackPromptRenderer { .child(detail) })) .child(h_flex().justify_end().gap_2().children( - self.actions.iter().rev().enumerate().map(|(ix, action)| { + self.actions.iter().enumerate().rev().map(|(ix, action)| { ui::Button::new(ix, action.clone()) .label_size(LabelSize::Large) .style(ButtonStyle::Filled)