Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/commands.rs')
| -rw-r--r-- | helix-term/src/commands.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 44633741..2cbdeb45 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -601,6 +601,8 @@ impl MappableCommand { extend_to_word, "Extend to a two-character label", goto_next_tabstop, "Goto next snippet placeholder", goto_prev_tabstop, "Goto next snippet placeholder", + rotate_selections_first, "Make the first selection your primary one", + rotate_selections_last, "Make the last selection your primary one", ); } @@ -5292,6 +5294,21 @@ fn rotate_selections_backward(cx: &mut Context) { rotate_selections(cx, Direction::Backward) } +fn rotate_selections_first(cx: &mut Context) { + let (view, doc) = current!(cx.editor); + let mut selection = doc.selection(view.id).clone(); + selection.set_primary_index(0); + doc.set_selection(view.id, selection); +} + +fn rotate_selections_last(cx: &mut Context) { + let (view, doc) = current!(cx.editor); + let mut selection = doc.selection(view.id).clone(); + let len = selection.len(); + selection.set_primary_index(len - 1); + doc.set_selection(view.id, selection); +} + enum ReorderStrategy { RotateForward, RotateBackward, |