aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGokul Soumya2022-02-07 16:04:06 +0000
committerBlaž Hrastnik2022-02-08 07:44:39 +0000
commit547c3ecd0c72f2b88fa2b3c1321ad9adcb42ee47 (patch)
tree80393d55e9d9952329cf3eabed2a79813ab58439
parente90276df0b7a643e6fa8a7bb61a21d93c57383ef (diff)
Preselect first item in code action popup menu
-rw-r--r--helix-term/src/commands.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 9b98e6c4..d9fb2d55 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3503,7 +3503,7 @@ pub fn code_action(cx: &mut Context) {
return;
}
- let picker = ui::Menu::new(actions, move |editor, code_action, event| {
+ let mut picker = ui::Menu::new(actions, move |editor, code_action, event| {
if event != PromptEvent::Validate {
return;
}
@@ -3531,6 +3531,8 @@ pub fn code_action(cx: &mut Context) {
}
}
});
+ picker.move_down(); // pre-select the first item
+
let popup = Popup::new("code-action", picker).margin(helix_view::graphics::Margin {
vertical: 1,
horizontal: 1,