@@ -856,18 +856,13 @@ export namespace CoreNavigationCommands {
856856 }
857857 } ) ) ;
858858
859- export const CursorLineStart : CoreEditorCommand = registerEditorCommand ( new class extends CoreEditorCommand {
860- constructor ( ) {
861- super ( {
862- id : 'cursorLineStart' ,
863- precondition : undefined ,
864- kbOpts : {
865- weight : CORE_WEIGHT ,
866- kbExpr : EditorContextKeys . textInputFocus ,
867- primary : 0 ,
868- mac : { primary : KeyMod . WinCtrl | KeyCode . KEY_A }
869- }
870- } ) ;
859+ class LineStartCommand extends CoreEditorCommand {
860+
861+ private readonly _inSelectionMode : boolean ;
862+
863+ constructor ( opts : ICommandOptions & { inSelectionMode : boolean ; } ) {
864+ super ( opts ) ;
865+ this . _inSelectionMode = opts . inSelectionMode ;
871866 }
872867
873868 public runCoreEditorCommand ( cursors : ICursors , args : any ) : void {
@@ -885,11 +880,35 @@ export namespace CoreNavigationCommands {
885880 for ( let i = 0 , len = cursors . length ; i < len ; i ++ ) {
886881 const cursor = cursors [ i ] ;
887882 const lineNumber = cursor . modelState . position . lineNumber ;
888- result [ i ] = CursorState . fromModelState ( cursor . modelState . move ( false , lineNumber , 1 , 0 ) ) ;
883+ result [ i ] = CursorState . fromModelState ( cursor . modelState . move ( this . _inSelectionMode , lineNumber , 1 , 0 ) ) ;
889884 }
890885 return result ;
891886 }
892- } ) ;
887+ }
888+
889+ export const CursorLineStart : CoreEditorCommand = registerEditorCommand ( new LineStartCommand ( {
890+ inSelectionMode : false ,
891+ id : 'cursorLineStart' ,
892+ precondition : undefined ,
893+ kbOpts : {
894+ weight : CORE_WEIGHT ,
895+ kbExpr : EditorContextKeys . textInputFocus ,
896+ primary : 0 ,
897+ mac : { primary : KeyMod . WinCtrl | KeyCode . KEY_A }
898+ }
899+ } ) ) ;
900+
901+ export const CursorLineStartSelect : CoreEditorCommand = registerEditorCommand ( new LineStartCommand ( {
902+ inSelectionMode : true ,
903+ id : 'cursorLineStartSelect' ,
904+ precondition : undefined ,
905+ kbOpts : {
906+ weight : CORE_WEIGHT ,
907+ kbExpr : EditorContextKeys . textInputFocus ,
908+ primary : 0 ,
909+ mac : { primary : KeyMod . WinCtrl | KeyMod . Shift | KeyCode . KEY_A }
910+ }
911+ } ) ) ;
893912
894913 class EndCommand extends CoreEditorCommand {
895914
@@ -935,18 +954,13 @@ export namespace CoreNavigationCommands {
935954 }
936955 } ) ) ;
937956
938- export const CursorLineEnd : CoreEditorCommand = registerEditorCommand ( new class extends CoreEditorCommand {
939- constructor ( ) {
940- super ( {
941- id : 'cursorLineEnd' ,
942- precondition : undefined ,
943- kbOpts : {
944- weight : CORE_WEIGHT ,
945- kbExpr : EditorContextKeys . textInputFocus ,
946- primary : 0 ,
947- mac : { primary : KeyMod . WinCtrl | KeyCode . KEY_E }
948- }
949- } ) ;
957+ class LineEndCommand extends CoreEditorCommand {
958+
959+ private readonly _inSelectionMode : boolean ;
960+
961+ constructor ( opts : ICommandOptions & { inSelectionMode : boolean ; } ) {
962+ super ( opts ) ;
963+ this . _inSelectionMode = opts . inSelectionMode ;
950964 }
951965
952966 public runCoreEditorCommand ( cursors : ICursors , args : any ) : void {
@@ -965,11 +979,35 @@ export namespace CoreNavigationCommands {
965979 const cursor = cursors [ i ] ;
966980 const lineNumber = cursor . modelState . position . lineNumber ;
967981 const maxColumn = context . model . getLineMaxColumn ( lineNumber ) ;
968- result [ i ] = CursorState . fromModelState ( cursor . modelState . move ( false , lineNumber , maxColumn , 0 ) ) ;
982+ result [ i ] = CursorState . fromModelState ( cursor . modelState . move ( this . _inSelectionMode , lineNumber , maxColumn , 0 ) ) ;
969983 }
970984 return result ;
971985 }
972- } ) ;
986+ }
987+
988+ export const CursorLineEnd : CoreEditorCommand = registerEditorCommand ( new LineEndCommand ( {
989+ inSelectionMode : false ,
990+ id : 'cursorLineEnd' ,
991+ precondition : undefined ,
992+ kbOpts : {
993+ weight : CORE_WEIGHT ,
994+ kbExpr : EditorContextKeys . textInputFocus ,
995+ primary : 0 ,
996+ mac : { primary : KeyMod . WinCtrl | KeyCode . KEY_E }
997+ }
998+ } ) ) ;
999+
1000+ export const CursorLineEndSelect : CoreEditorCommand = registerEditorCommand ( new LineEndCommand ( {
1001+ inSelectionMode : true ,
1002+ id : 'cursorLineEndSelect' ,
1003+ precondition : undefined ,
1004+ kbOpts : {
1005+ weight : CORE_WEIGHT ,
1006+ kbExpr : EditorContextKeys . textInputFocus ,
1007+ primary : 0 ,
1008+ mac : { primary : KeyMod . WinCtrl | KeyMod . Shift | KeyCode . KEY_E }
1009+ }
1010+ } ) ) ;
9731011
9741012 class TopCommand extends CoreEditorCommand {
9751013
0 commit comments