mirror of https://github.com/helix-editor/helix
Goto next/prev in last picker
parent
ee3171cc54
commit
69c23e5f6e
|
@ -35,7 +35,7 @@ use helix_view::{
|
||||||
document::{FormatterError, Mode, SCRATCH_BUFFER_NAME},
|
document::{FormatterError, Mode, SCRATCH_BUFFER_NAME},
|
||||||
editor::{Action, CompleteAction},
|
editor::{Action, CompleteAction},
|
||||||
info::Info,
|
info::Info,
|
||||||
input::KeyEvent,
|
input::{Event, KeyEvent, KeyModifiers},
|
||||||
keyboard::KeyCode,
|
keyboard::KeyCode,
|
||||||
tree,
|
tree,
|
||||||
view::View,
|
view::View,
|
||||||
|
@ -464,6 +464,8 @@ impl MappableCommand {
|
||||||
goto_prev_test, "Goto previous test",
|
goto_prev_test, "Goto previous test",
|
||||||
goto_next_paragraph, "Goto next paragraph",
|
goto_next_paragraph, "Goto next paragraph",
|
||||||
goto_prev_paragraph, "Goto previous 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_launch, "Launch debug target",
|
||||||
dap_restart, "Restart debugging session",
|
dap_restart, "Restart debugging session",
|
||||||
dap_toggle_breakpoint, "Toggle breakpoint",
|
dap_toggle_breakpoint, "Toggle breakpoint",
|
||||||
|
@ -3249,6 +3251,28 @@ fn goto_prev_diag(cx: &mut Context) {
|
||||||
doc.set_selection(view.id, selection);
|
doc.set_selection(view.id, selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
fn goto_first_change(cx: &mut Context) {
|
||||||
goto_first_change_impl(cx, false);
|
goto_first_change_impl(cx, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,7 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
|
||||||
"c" => goto_prev_comment,
|
"c" => goto_prev_comment,
|
||||||
"T" => goto_prev_test,
|
"T" => goto_prev_test,
|
||||||
"p" => goto_prev_paragraph,
|
"p" => goto_prev_paragraph,
|
||||||
|
"[" => goto_prev_in_last_picker,
|
||||||
"space" => add_newline_above,
|
"space" => add_newline_above,
|
||||||
},
|
},
|
||||||
"]" => { "Right bracket"
|
"]" => { "Right bracket"
|
||||||
|
@ -128,6 +129,7 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
|
||||||
"c" => goto_next_comment,
|
"c" => goto_next_comment,
|
||||||
"T" => goto_next_test,
|
"T" => goto_next_test,
|
||||||
"p" => goto_next_paragraph,
|
"p" => goto_next_paragraph,
|
||||||
|
"]" => goto_next_in_last_picker,
|
||||||
"space" => add_newline_below,
|
"space" => add_newline_below,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue