pull/7921/merge
Evgeny Andreeshchev 2025-06-15 13:09:25 +02:00 committed by GitHub
commit b56ed15fc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View File

@ -45,7 +45,7 @@ use helix_view::{
document::{FormatterError, Mode, SCRATCH_BUFFER_NAME},
editor::Action,
info::Info,
input::KeyEvent,
input::{Event, KeyEvent, KeyModifiers},
keyboard::KeyCode,
theme::Style,
tree,
@ -569,6 +569,8 @@ impl MappableCommand {
goto_prev_entry, "Goto previous pairing",
goto_next_paragraph, "Goto next paragraph",
goto_prev_paragraph, "Goto previous paragraph",
goto_next_in_last_picker, "Goto next in last picker",
goto_prev_in_last_picker, "Goto previous in last picker",
dap_launch, "Launch debug target",
dap_restart, "Restart debugging session",
dap_toggle_breakpoint, "Toggle breakpoint",
@ -3996,6 +3998,28 @@ fn goto_prev_diag(cx: &mut Context) {
cx.editor.apply_motion(motion)
}
fn goto_next_in_last_picker(cx: &mut Context) {
cx.callback = Some(Box::new(|compositor, cx| {
if let Some(picker) = &mut compositor.last_picker {
picker.handle_event( &Event::Key(KeyEvent { code: KeyCode::Down, modifiers: KeyModifiers::NONE }), cx);
picker.handle_event( &Event::Key(KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::NONE }), cx);
} else {
cx.editor.set_error("no last picker")
}
}));
}
fn goto_prev_in_last_picker(cx: &mut Context) {
cx.callback = Some(Box::new(|compositor, cx| {
if let Some(picker) = &mut compositor.last_picker {
picker.handle_event( &Event::Key(KeyEvent { code: KeyCode::Up, modifiers: KeyModifiers::NONE }), cx);
picker.handle_event( &Event::Key(KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::NONE }), cx);
} else {
cx.editor.set_error("no last picker")
}
}));
}
fn goto_first_change(cx: &mut Context) {
goto_first_change_impl(cx, false);
}

View File

@ -120,6 +120,7 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
"e" => goto_prev_entry,
"T" => goto_prev_test,
"p" => goto_prev_paragraph,
"[" => goto_prev_in_last_picker,
"space" => add_newline_above,
},
"]" => { "Right bracket"
@ -134,6 +135,7 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
"e" => goto_next_entry,
"T" => goto_next_test,
"p" => goto_next_paragraph,
"]" => goto_next_in_last_picker,
"space" => add_newline_below,
},