@@ -601,6 +601,8 @@ impl MappableCommand {
601
601
extend_to_word, "Extend to a two-character label" ,
602
602
goto_next_tabstop, "Goto next snippet placeholder" ,
603
603
goto_prev_tabstop, "Goto next snippet placeholder" ,
604
+ goto_first_selection, "Make the first selection your primary one" ,
605
+ goto_last_selection, "Make the last selection your primary one" ,
604
606
) ;
605
607
}
606
608
@@ -5290,6 +5292,21 @@ fn rotate_selections_backward(cx: &mut Context) {
5290
5292
rotate_selections ( cx, Direction :: Backward )
5291
5293
}
5292
5294
5295
+ pub fn goto_first_selection ( cx : & mut Context ) {
5296
+ let ( view, doc) = current ! ( cx. editor) ;
5297
+ let mut selection = doc. selection ( view. id ) . clone ( ) ;
5298
+ selection. set_primary_index ( 0 ) ;
5299
+ doc. set_selection ( view. id , selection) ;
5300
+ }
5301
+
5302
+ pub fn goto_last_selection ( cx : & mut Context ) {
5303
+ let ( view, doc) = current ! ( cx. editor) ;
5304
+ let mut selection = doc. selection ( view. id ) . clone ( ) ;
5305
+ let len = selection. len ( ) ;
5306
+ selection. set_primary_index ( len - 1 ) ;
5307
+ doc. set_selection ( view. id , selection) ;
5308
+ }
5309
+
5293
5310
enum ReorderStrategy {
5294
5311
RotateForward ,
5295
5312
RotateBackward ,
0 commit comments